btph / gateway-sdk
v3.0
2023-09-07 07:43 UTC
README
为 Laravel 项目提供的轻量级 Gateway API SDK
安装
使用 composer 安装包
composer require btph/gateway-sdk
⚠️ 确保通过运行 php artisan vendor:publish
发布服务提供者,并选择该包。
环境变量
发布后,将以下环境变量设置到项目的 .env
文件中。
GATEWAY_API_KEY=<YOUR GATEWAY API KEY> GATEWAY_SECRET_KEY=<YOUR GATEWAY SECRET KEY> GATEWAY_API_URL=<GATEWAY API URL>
如何使用
绑定客户
在创建意图之前绑定客户详细信息。⚠️您必须始终首先调用 attachCustomer
函数。
// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object]);
客户对象
创建意图
要创建存款意图,您必须首先通过调用 attachCustomer()
函数绑定客户,然后调用 createDepositIntent()
或 createWithdrawalIntent()
函数。
存款意图
// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->createDepositIntent([..intent_details]);
提款意图
// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->createWithdrawalIntent([..intent_details]);
存款意图对象
提款意图对象
处理提款交易
在创建 提款意图 后,您现在可以通过调用 processWithdrawalIntent()
来处理,您将需要要处理的交易的 交易编号,因此建议在您的应用程序内部某处存储它。
处理提款
// use Btph\GatewaySdk\Facade\Gateway
Gateway::attachCustomer([...customer_object])->processWithdrawalIntent(<transaction number>, [..details]);
processWithdrawalIntent()
的第一个参数是要处理的交易编号,第二个参数将取决于您在创建意图时使用的交易方法。
处理本地银行转账
要使用本地银行转账处理提款,需要以下密钥对值
⚠️ 当处理以 JPY 货币作为信用货币的提款时的重要注意事项
要处理此类交易,需要额外的密钥对值。
处理第三方解决方案
东方钱包
对于东方钱包提款,需要以下密钥对值。