sohagsrz/nowpayments-php-sdk
Composer 安装命令:
composer require sohagsrz/nowpayments-php-sdk
包简介
A professional, OOP-compliant PHP SDK for the NowPayments.io API.
README 文档
README
A professional, standalone, and OOP-compliant PHP library for integrating with the NowPayments.io API.
Features
- Supports all main methods: Invoices, Payments, Estimates, Currencies, and Status.
- Environment Aware: Seamlessly switch between Sandbox and Production.
- Secure Webhooks: Built-in IPN signature verification.
- Exception Handling: Custom exceptions with raw API error detail.
- Standalone: Perfect for any PHP project or framework.
Installation
composer require sohagsrz/nowpayments-php-sdk
Basic Usage
use NowPayments\NowPayments; $sdk = new NowPayments('YOUR-API-KEY', true); // true for Sandbox // Get API Status $status = $sdk->getStatus(); // Create a professional crypto invoice $invoice = $sdk->createInvoice([ 'price_amount' => 10.00, 'price_currency' => 'usd', 'order_id' => '12345', 'order_description' => 'Premium Upgrade', 'success_url' => 'https://yoursite.com/success', 'ipn_callback_url' => 'https://yoursite.com/webhook' ]); // Redirect user to payment header('Location: ' . $invoice['invoice_url']);
Webhook Verification
$receivedSig = $_SERVER['HTTP_X_NOWPAYMENTS_SIG']; $payload = json_decode(file_get_contents('php://input'), true); $sdk = new NowPayments('API-KEY', false, 'YOUR-IPN-SECRET'); if ($sdk->verifyIPNSignature($payload, $receivedSig)) { // Payment is authentic! }
Requirements
- PHP >= 7.4
- GuzzleHTTP ^7.0
License
MIT
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-05