yorts / xendit
一个用于通过API无缝集成第三方支付网关或支付服务的包。简化在PHP应用程序中安全处理支付和支付。
v1.0.1
2024-03-22 03:58 UTC
This package is auto-updated.
Last update: 2024-09-22 05:13:23 UTC
README
Xendit客户端是XENDIT API的PHP包装器
目录
安装
composer require yorts/xendit
基本用法
创建支付
<?php require_once( 'vendor/autoload.php' ); use Yorts\Xendit\XenditPayout; $client = new XenditPayout('{YOUR_API_KEY}'); $params = [ 'reference_id' => 'your reference id', 'channel_code' => 'channel code you want', 'channel_properties' => [ 'account_holder_name' => 'your holder name', 'account_number' => 'your account number', ], 'amount' => (float)$request->amount, 'currency' => 'your currency', 'description' => 'Description you want', "receipt_notification": { //receipt_notification is optional "email_to": [ "somebody@xendit.co" ], "email_cc": [ "somebody@xendit.co" ] }, "metadata": { //meta data is optional "lotto_outlet": 'your outlet' } ]; dd($client->createPayout($params));
响应将包含支付详情
{ "id": "disb-48ee0751-abb3-4df5-85c7-24bcd3fabdec", "amount": 1000, "channel_code": "PH_BDO", "currency": "PHP", "description": "Sample Payout", "reference_id": "sample-payout-123", "status": "ACCEPTED", "created": "2024-03-22T03:24:52.647Z", "updated": "2024-03-22T03:24:52.647Z", "estimated_arrival_time": "2024-03-22T03:39:52.646Z", "business_id": "65f28790f16055763085bbdd", "channel_properties": { "account_number": "123456789", "account_holder_name": "Caster Troy Ventura" } }
通过参考ID检索支付
$reference_id = 'sample-payout-123'; // will return all payout based on your reference id dd($client->getPayoutReferenceId($reference_id));
通过ID检索支付
$id = 'disb-48ee0751-abb3-4df5-85c7-24bcd3fabdec'; // will return all payout based on xendit transaction id dd($client->getPayoutId($id));