sdrenth/spraypay

此包最新版本(1.0.0)没有提供许可证信息。

PHP 的 SprayPay API 客户端

1.0.0 2021-03-23 16:51 UTC

This package is auto-updated.

Last update: 2024-09-20 10:02:15 UTC


README

PHP 的 SprayPay API 客户端。

入门

有关用法和允许的参数,请参阅官方 SprayPay API 文档。

初始化客户端

$client = new SprayPayApiClient();
$client->setApiKey('YOUR_API_KEY);
$client->setWebshopId('YOUR_WEBSHOP_ID');
$client->setTestMode();

运行预检请求

$response = $client->loanrequestpreflight->preflight([
    'emailAddress'       => 'some_email',
    'webshopOrderAmount' => '10.00',
    'webshopOrderId'     => 1,
    'webshopCustomerId'  => 1,
    'returnUrl'          => ''
]);

支付/贷款请求

$loanrequest->create($data, true, true);

获取订单状态

$this->client->orderstatus->get(1);

创建退款请求

$client->chargebackrequest->create([
    'date'                      => '2020-02-02',
    'amount'                    => '10.00',
    'chargebackNotificationUrl' => '',
    'orderId'                   => 1,
    'reason'                    => 'Some reason'
]);

获取退款请求状态

$response = $client->chargebackrequest->getStatus(['reference' => 'SOME_REFERENCE']);

支付资源示例

$payment = new Payment($client->loanrequest->create($data, true, true));
$payment->isPaid();