solidgate / php-sdk
SolidGate支付网关的PHP API SDK
v1.6.2
2024-04-11 10:03 UTC
Requires
- php: ^7.1|^8.0
- ext-json: *
- ext-openssl: *
- guzzlehttp/guzzle: ^6.1|^7
README
SolidGate API
这个库提供了SolidGate支付网关的基本API选项。
安装
使用Composer
$ composer require solidgate/php-sdk
{ "require": { "solidgate/php-sdk": "~1.0" } }
用法
卡门示例
<?php use SolidGate\API\Api; $api = new Api('YourMerchantId', 'YourPrivateKey'); $response = $api->charge(['SomePaymentAttributes from API reference']);
对账示例
<?php use SolidGate\API\Api; $api = new Api('YourMerchantId', 'YourPrivateKey'); $dateFrom = new \DateTime("2019-01-01 00:00:00+00:00"); $dateTo = new \DateTime("2020-01-06 00:00:00+00:00"); $orderIterator = $api->getUpdatedOrders($dateFrom, $dateTo); //$orderIterator = $api->getUpdatedChargebacks($dateFrom, $dateTo); //$orderIterator = $api->getUpdatedAlerts($dateFrom, $dateTo); foreach ($orderIterator as $order) { // process one order } if ($api->getException() instanceof \Throwable) { // save exception to log and retry request (if necessary) }
表单重置示例
<?php use SolidGate\API\Api; $api = new Api('YourMerchantId', 'YourPrivateKey'); $response = $api->formResign(['SomePaymentAttributes from API reference']); $response->toArray(); // pass to your Frontend