cloudycity / ipaynow-sdk
现在支付 SDK
v1.0.0
2021-04-08 06:10 UTC
Requires
- php: >=5.6.0
- guzzlehttp/guzzle: ^6.5|^7.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-10-29 06:00:20 UTC
README
Requirement
- PHP 5.6 +
Installation
composer require cloudycity/ipaynow-sdk:*
Usage
use CloudyCity\IPayNowSDK\IPayNow; use CloudyCity\IPayNowSDK\Exceptions\Exceptions; use CloudyCity\IPayNowSDK\Exceptions\InvalidSignException; $config = [ 'appid' => '123456789012345', // 商户应用唯一标识 'key' => 'abcdefghijklmnopqrstuvwxyz123456789012', // 密钥 'notify_url' => 'http://cloudycity.me/notify.php', // 异步回调地址 (拉起支付时必选,只用于验证回调时可选) 'return_url' => 'http://cloudycity.me/return.php', // 同步回调地址 (拉起支付时必选,只用于验证回调时可选) ]; $order = [ 'no' => '1234560', // 订单号 'money' => 600, // 订单金额(单位: 分) 'attach' => '', // 可选,商户保留域 'detail' => '', // 可选,订单详情 'ip' => '0.0.0.0', // 可选,支付端IP ]; // 拉起支付 try { $url = IPayNow::wechat($config)->pre($order); $url = IPayNow::ali($config)->pre($order); } catch (Exceptions $e) { // } // 校验回调 try { PayNow::wechat($config)->verify(); PayNow::ali($config)->verify(); } catch (InvalidSignException $e) { // }
License
MIT