payselection / payselection-php-client
Payselection API 客户端
v2.0.10
2024-09-16 08:41 UTC
Requires
- php: >=7.4
- ext-json: *
- guzzlehttp/guzzle: >=7.5.1
- myclabs/php-enum: >=1.6
README
目录
安装
可以使用 composer 安装库
composer require payselection/payselection-php-client
入门指南
- 创建客户端对象实例。
$apiClient = new \PaySelection\Library(); $apiClient->setConfiguration([ 'webpay_url' => 'https://webform.payselection.com', 'api_url' => 'https://gw.payselection.com', 'site_id' => '123', 'secret_key' => '###########', 'webhook_url' => 'https://webhook.site/notification/' ]);
webhook_url 的值必须与请求中的 WebhookUrl 的值匹配
- 调用所需的 API 方法。
API 方法
创建 Webpay
创建付款,以便买家能够支付
try { $response = $apiClient->createWebPay([ 'MetaData' => [ 'PaymentType' => 'Pay' ], 'PaymentRequest' => [ 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac1200021', 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Order description', 'RebillFlag' => true, 'ExtraData' => [ 'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3' ], ], 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'CustomerInfo' => [ 'ZIP' => '222410', 'Language' => 'ru' ], 'RecurringData' => [ 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Recurring description', 'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3', 'AccountId' => 'order63', 'Email' => 'user@example.com', 'StartDate' => '2023-05-11T13:38+0000', 'Interval' => '5', 'Period' => 'day', 'MaxPeriods' => '3', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ] ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
创建 Paylink
此方法允许创建一个链接以跳转到支付小部件。
try { $response = $apiClient->createPaylink([ 'MetaData' => [ 'PaymentType' => 'Pay', 'TypeLink' => 'Reusable', 'PreviewForm' => true, 'SendSMS' => true, 'OfferUrl' => 'string', 'SendBill' => true ], 'PaymentRequest' => [ 'OrderId' => 'string', 'Amount' => '123.45', 'Currency' => 'RUB', 'Description' => 'string', 'RebillFlag' => false, 'ExtraData' => [ 'ReturnUrl' => 'https://api.payselection.com/', 'SuccessUrl' => 'string', 'DeclineUrl' => 'string', 'WebhookUrl' => 'https://webhook.site/94a06b69', 'ShortDescription' => 'string', 'DynamicAmount' => true ] ], 'ReceiptData' => [ 'timestamp' => 'string', 'external_id' => 'string', 'receipt' => [ 'client' => [ 'name' => 'string', 'inn' => 'string', 'email' => 'string', 'phone' => 'string' ], 'company' => [ 'email' => 'string', 'sno' => 'osn', 'inn' => 'string', 'payment_address' => 'string' ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ] ], 'items' => [ [ 'name' => 'string', 'price' => 42949673, 'quantity' => 99999.999, 'sum' => 42949672.95, 'measurement_unit' => 'string', 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'nomenclature_code' => 'string', 'vat' => [ 'type' => 'none', 'sum' => 99999999.99 ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ], 'name' => 'string', 'inn' => 'string' ], 'user_data' => 'string', 'excise' => 0, 'country_code' => 'str', 'declaration_number' => 'string' ] ], 'payments' => [ [ 'type' => 0, 'sum' => 99999999.99 ] ], 'vats' => [ [ 'type' => 'none', 'sum' => 99999999.99 ] ], 'total' => 99999999.99, 'additional_check_props' => 'string', 'cashier' => 'string', 'additional_user_props' => [ 'name' => 'string', 'value' => 'string' ] ] ], 'CustomerInfo' => [ 'Email' => 'user@example.com', 'ReceiptEmail' => 'user@example.com', 'Phone' => '+79999999999', 'Language' => 'en', 'Address' => 'string', 'Town' => 'string', 'ZIP' => 'string', 'Country' => 'RUS', 'UserId' => 'string' ], 'RecurringData' => [ 'Amount' => '123.45', 'Currency' => 'RUB', 'Description' => 'string', 'WebhookUrl' => 'https://webhook.site/94a06b69', 'AccountId' => 'order63', 'Email' => 'user@example.com', 'StartDate' => '2023-01-11T13:38+0000', 'Interval' => '5', 'Period' => 'day', 'MaxPeriods' => '3', 'ReceiptData' => [ 'timestamp' => 'string', 'external_id' => 'string', 'receipt' => [ 'client' => [ 'name' => 'string', 'inn' => 'string', 'email' => 'string', 'phone' => 'string' ], 'company' => [ 'email' => 'string', 'sno' => 'osn', 'inn' => 'string', 'payment_address' => 'string' ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ] ], 'items' => [ [ 'name' => 'string', 'price' => 42949673, 'quantity' => 99999.999, 'sum' => 42949672.95, 'measurement_unit' => 'string', 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'nomenclature_code' => 'string', 'vat' => [ 'type' => 'none', 'sum' => 99999999.99 ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ], 'name' => 'string', 'inn' => 'string' ], 'user_data' => 'string', 'excise' => 0, 'country_code' => 'str', 'declaration_number' => 'string' ] ], 'payments' => [ [ 'type' => 0, 'sum' => 99999999.99 ] ], 'vats' => [ [ 'type' => 'none', 'sum' => 99999999.99 ] ], 'total' => 99999999.99, 'additional_check_props' => 'string', 'cashier' => 'string', 'additional_user_props' => [ 'name' => 'string', 'value' => 'string' ] ] ] ], 'ExtendedData' => [ 'FIO' => [ 'enabled' => true, 'required' => true ], 'Phone' => [ 'enabled' => true, 'required' => true ], 'Email' => [ 'enabled' => true, 'required' => true ], 'TokenLifeTime' => 10, 'Custom' => [ 'enabled' => true, 'required' => true, 'name' => 'string' ] ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
作废 Paylink
此方法允许取消支付小部件的链接。
try { $response = $apiClient->createPaylinkVoid([ 'Id' => 'string' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
获取订单状态
通过 OrderId 获取订单状态
try { $response = $apiClient->getOrderStatus('a3a393d8-ac47-11ed-afa1-0242ac120002'); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
获取订单状态(扩展版)
扩展查询用于获取通过 orderId 获取的当前状态信息。
try { $response = $apiClient->getOrderStatusExt('a3a393d8-ac47-11ed-afa1-0242ac120002'); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
获取交易状态
通过 TransactionId 获取状态
try { $response = $apiClient->getTransactionStatus('PS00000000000001'); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
获取交易状态(扩展版)
扩展查询用于获取通过 TransactionId 获取的当前状态信息。
try { $response = $apiClient->getTransactionStatusExt('PS00000000000001'); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
按日期获取交易状态(扩展版)
扩展查询用于获取选定日期范围内的交易状态。
try { $response = $apiClient->getTransactionStatusByDates([ 'StartCreationDate' => '2022-12-31T00:00:00', 'EndCreationDate' => '2023-12-31T00:00:00', 'PageNumber' => 1, 'TimeZone' => 'Africa/Abidjan', 'Statuses' => [ 'success', 'voided', 'preauthorized', 'pending', 'declined', 'wait_for_3ds', 'redirect' ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
创建付款
单阶段支付操作 – 在操作执行后立即扣除资金。
try { $response = $apiClient->createPayment([ 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002', 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Order description', 'RebillFlag' => false, 'CustomerInfo' => [ 'IP' => '192.168.1.10' ], 'ExtraData' => [ 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ], 'PaymentMethod' => 'Card', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'PaymentDetails' => [ 'CardNumber'=> '4111111111111111', 'ExpMonth'=> '02', 'ExpYear'=> '25', 'CardholderName'=> 'Card Holder', 'CVC'=> '789' ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
创建阻止
双阶段支付操作 – 资金被锁定在卡上。如果授权成功,必须在 5 天内完成交易,否则 5 天内未通过请求进行扣款,自动取消扣款。此外,可以设置 rebillFlag 以启用周期性付款。
try { $response = $apiClient->createBlock([ 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002', 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Order description', 'RebillFlag' => false, 'CustomerInfo' => [ 'IP' => '192.168.1.10' ], 'ExtraData' => [ 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ], 'PaymentMethod' => 'Card', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'PaymentDetails' => [ 'CardNumber'=> '4111111111111111', 'ExpMonth'=> '02', 'ExpYear'=> '25', 'CardholderName'=> 'Card Holder', 'CVC'=> '789' ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
重新计费付款
自动从之前绑定的卡上扣除资金的操作。
try { $response = $apiClient->rebillPayment([ 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002', 'Amount' => '1.00', 'Currency' => 'RUB', 'Description' => 'Order description', 'RebillFlag' => true, 'RebillId' => 'GE00000001173680', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
确认付款
用于 Pay 或 Block 操作的 3DS 后,在收到银行的验证结果以完成单阶段/双阶段支付操作时使用。
try { $response = $apiClient->confirmPayment([ 'TransactionId' => 'PS00000000000001', 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002', 'PaRes' => '123', 'MD' => '456' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
创建退款
只有成功的交易可以退款
try { $response = $apiClient->createRefund([ 'TransactionId' => 'PS00000000000001', 'Amount' => '1.00', 'Currency' => 'RUB', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
取消支付
在先前进行的双阶段支付操作中取消对卡上资金的锁定。
try { $response = $apiClient->cancelPayment([ 'TransactionId' => 'PS00000000000001', 'Amount' => '100.00', 'Currency' => 'RUB', 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
收费支付
在先前进行的双阶段支付操作中从卡上扣除资金。
try { $response = $apiClient->chargePayment([ 'TransactionId' => 'PS00000000000001', 'Amount' => '100.00', 'Currency' => 'RUB', 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
取消订阅
取消周期性支付。使用该方法将取消所有注册的周期性支付(RebillId所传递的)。
try { $response = $apiClient->cancelSubscription([ 'RebillId' => 'PS00000000000001' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
创建退款
单阶段支付操作 – 在操作执行后立即扣除资金。
try { $response = $apiClient->createPayout([ 'OrderId' => 'a3a393d8-ac47-11ed-afa1-0242ac120002', 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Order description', 'CustomerInfo' => [ 'IP' => '192.168.1.10' ], 'ExtraData' => [ 'WebhookUrl' => 'https://webhook.site/38fb8867-a648-423e-9146-30576b2ad8e4' ], 'PayoutMethod' => 'Card', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ], 'PayoutDetails' => [ 'CardNumber'=> '4111111111111111', 'CardholderName'=> 'Card Holder', ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
获取余额
获取退款可用的余额操作。
try { $response = $apiClient->getBalance(); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
注册周期性支付
注册通过先前绑定的卡进行周期性支付。
try { $response = $apiClient->registerRecurring([ 'RebillId' => 'GE00000001173680', 'Amount' => '100.00', 'Currency' => 'RUB', 'Description' => 'Recurring description', 'WebhookUrl' => 'https://webhook.site/f2bea4b3-e85c-40e9-9587-b588cfda84d3', 'AccountId' => 'order63', 'Email' => 'user@example.com', 'StartDate' => '2023-05-11T13:38+0000', 'Interval' => '5', 'Period' => 'day', 'MaxPeriods' => '3', 'ReceiptData' => [ 'timestamp' => '2023-01-11T13:38+0000', 'external_id' => '12345678', 'receipt' => [ 'client' => [ 'name' => 'Inan Ivanov', 'email' => 'ivan@example.com', ], 'company' => [ 'email' => 'company@example.com', 'inn' => '12345', 'payment_address' => 'company address', ], 'items' => [ [ 'name' => 'Product title 1', 'price' => 123.00, 'quantity' => 1, 'sum' => 123.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], [ 'name' => 'Product title 2', 'price' => 10.00, 'quantity' => 2, 'sum' => 20.00, 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'vat' => [ 'type' => 'vat0' ] ], ], 'payments' => [ [ 'type' => 1, 'sum' => 143.00 ] ], 'total' => 143.00 ] ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
取消周期性支付
取消周期性支付。
try { $response = $apiClient->cancelRecurring([ 'RecurringId' => '1173' ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
搜索周期性支付
按选定参数搜索周期性支付(订阅)。
try { $response = $apiClient->searchRecurring([ 'RebillId' => 'PS00000000000001', 'RecurringId' => '1173', 'AccountId' => 'order63', ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
更改周期性支付
更改周期性支付(订阅)的参数。
try { $response = $apiClient->changeRecurring([ 'RecurringId' => '1173', 'MaxPeriods' => '3', 'StartDate' => '2023-01-11T13:38+0000', 'Interval' => '5', 'Period' => 'day', 'Amount' => '123.45', 'ReceiptData' => [ 'timestamp' => 'string', 'external_id' => 'string', 'receipt' => [ 'client' => [ 'name' => 'string', 'inn' => 'string', 'email' => 'string', 'phone' => 'string' ], 'company' => [ 'email' => 'string', 'sno' => 'osn', 'inn' => 'string', 'payment_address' => 'string' ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ] ], 'items' => [ [ 'name' => 'string', 'price' => 42949673, 'quantity' => 99999.999, 'sum' => 42949672.95, 'measurement_unit' => 'string', 'payment_method' => 'full_prepayment', 'payment_object' => 'commodity', 'nomenclature_code' => 'string', 'vat' => [ 'type' => 'none', 'sum' => 99999999.99 ], 'agent_info' => [ 'type' => 'bank_paying_agent', 'paying_agent' => [ 'operation' => 'string', 'phones' => [ 'string' ] ], 'receive_payments_operator' => [ 'phones' => [ 'string' ] ], 'money_transfer_operator' => [ 'phones' => [ 'string' ], 'name' => 'string', 'address' => 'string', 'inn' => 'string' ] ], 'supplier_info' => [ 'phones' => [ 'string' ], 'name' => 'string', 'inn' => 'string' ], 'user_data' => 'string', 'excise' => 0, 'country_code' => 'str', 'declaration_number' => 'string' ] ], 'payments' => [ [ 'type' => 0, 'sum' => 99999999.99 ] ], 'vats' => [ [ 'type' => 'none', 'sum' => 99999999.99 ] ], 'total' => 99999999.99, 'additional_check_props' => 'string', 'cashier' => 'string', 'additional_user_props' => [ 'name' => 'string', 'value' => 'string' ] ] ] ]); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($response);
处理webhooks
try { $result = $apiClient->hookPay(); } catch (\Exception $e) { $response = $e->getMessage(); } var_dump($result);
许可
MIT