ziyoren/pay-sdk
最新稳定版本:v1.0.0
Composer 安装命令:
composer require ziyoren/pay-sdk
包简介
Ziyoren Pay SDK for payment integration
README 文档
README
A PHP SDK for integrating with Ziyoren Pay payment gateway.
Installation
You can install the package via composer:
composer require ziyoren/pay-sdk
Usage
Initialize Client
use Ziyoren\PaySdk\Client; $client = new Client('your-api-key', 'your-secret-key', 'https://api.ziyoren.com');
Create Payment Order
$orderData = [ 'out_trade_no' => 'ORDER-' . time(), 'total_amount' => 100.00, 'subject' => 'Product Name', 'notify_url' => 'https://your-domain.com/notify' ]; try { $result = $client->createPaymentOrder($orderData); // Handle result var_dump($result); } catch (\Ziyoren\PaySdk\Exceptions\ApiException $e) { // Handle API error echo "API Error: " . $e->getMessage(); }
Get Payment Status
try { $result = $client->getPaymentStatus('ORDER-123456789'); // Handle result var_dump($result); } catch (\Ziyoren\PaySdk\Exceptions\ApiException $e) { // Handle API error echo "API Error: " . $e->getMessage(); }
Verify Payment Notification
// Example: in your notification endpoint $notificationData = $_POST; // or however you receive the data if ($client->verifyNotification($notificationData)) { // Signature is valid, process the notification echo "Valid notification"; } else { // Invalid signature, reject http_response_code(400); echo "Invalid signature"; }
Testing
Run the tests using PHPUnit:
composer test
Contributing
Please see CONTRIBUTING for details.
License
The MIT License (MIT). Please see License File for more information.
统计信息
- 总下载量: 1
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-03-25