nuvocode/nuvo-payment-sdk
最新稳定版本:v1.0.0
Composer 安装命令:
composer require nuvocode/nuvo-payment-sdk
包简介
PHP SDK for Nuvo Payment API
README 文档
README
A simple PHP SDK for the Nuvo Payment API.
Installation
composer require nuvocode/nuvo-payment-sdk
Setup
Copy .env.example to .env and add your credentials:
NUVO_PAYMENT_BASE_URL=https://api.sample-payment.com NUVO_CLIENT_ID=your-client-id NUVO_CLIENT_SECRET=your-client-secret
Quick Start
use NuvoPayment\NuvoPayment; $nuvo = new NuvoPayment(); // Create a payment $payment = $nuvo->payments->create(49.99, 'USD', [ 'success' => 'https://example.com/success', 'cancel' => 'https://example.com/cancel' ]); if (!isset($payment['error'])) { header('Location: ' . $payment['redirect_url']); } else { echo "Error: " . $payment['message']; } // Get payment status $status = $nuvo->payments->find('pay_123');
API Methods
create(float $amount, string $currency = 'USD', array $redirectUrls = [], array $metadata = [])
Create a new payment and get a redirect URL.
$payment = $nuvo->payments->create( 49.99, 'USD', [ 'success' => 'https://example.com/success', 'cancel' => 'https://example.com/cancel' ], ['order_id' => 'ORD-12345'] );
find(string $paymentId)
Retrieve payment details by ID.
$status = $nuvo->payments->find('pay_123');
Response Format
Success:
[
'status' => 'success',
'payment_id' => 'pay_123',
'redirect_url' => 'https://checkout.stripe.com/...',
'provider' => 'stripe'
]
Error:
[
'error' => true,
'status' => 401,
'message' => 'Unauthorized'
]
Testing
# Run tests composer test # Run with coverage report composer test-coverage
Requirements
- PHP >= 8.1
- guzzlehttp/guzzle ^7.0
- vlucas/phpdotenv ^5.5
License
MIT
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-10-24