eversend / eversend-php-sdk
Eversend SDK for merchants
v1.0.1
2022-11-25 11:49 UTC
Requires
- guzzlehttp/guzzle: ^7.5
- symfony/cache: ^6.1
Requires (Dev)
- phpunit/phpunit: ^9
This package is auto-updated.
Last update: 2024-09-25 15:28:30 UTC
README
Eversend支付API的PHP SDK
目录
安装
composer require eversend/eversend-php-sdk
用法
use Eversend\Eversend $eversendClient = new Eversend( clientId= 'clientId', clientSecret= 'clientSecret', version=1 );
您可以从仪表板设置部分获取您的clientId和clientSecret
用法
钱包
获取所有钱包
$wallets = eversendClient.wallets().list();
获取一个钱包
$usdWallet = eversendClient.wallets().get(walletId: "USD");
交易
获取所有交易
$transactions = eversendClient.transactions().list(page: 1, limit: 10);
如果未设置page
和limit
,则分别使用默认的1
和10
。
获取一个交易
$transaction = eversendClient.transactions().get( transactionId: "EVS12345678" );
兑换
要从一个钱包兑换到另一个钱包,您首先需要生成一个报价。这将返回一个30秒超时的token,您可以使用它来执行兑换。
获取兑换报价
$quotation = eversendClient.exchange().createQuotation( from: "USD", to: "UGX", amount: 10.0 );
兑换货币
$exchange = eversendClient.exchange().createExchange( token: "dhhsggajjshhdhdhd", transactionRef: "EVS-12345678", // optional field );
收款人
获取收款人
$beneficiaries = eversendClient.beneficiaries.list( page: 1, limit: 10, );
如果未设置page
和limit
,则分别使用默认的1
和10
。
搜索收款人
$beneficiaries = eversendClient.beneficiaries().list( search: "Okello", page: 1, limit: 10, );
获取单个收款人
$beneficiary = eversendClient.beneficiaries().get( beneficiaryId: 100 );
创建收款人
$beneficiary = eversendClient.beneficiaries.create( firstName: "John", lastName: "Okello", country: "UG", // Alpha-2 country code phoneNumber: "+256712345678", // Should be in international format bankAccountName: "John Okello", bankAccountNumber: "12345678", bankName: "Stanbic Bank", bankCode: 1234 // You can get the bank code from payouts.getDeliveryBanks() );
注意,如果不需要银行支付,所有银行字段都是可选的
编辑收款人
$beneficiary = eversendClient.beneficiaries.update( beneficiaryId: 100, firstName: "John", lastName: "Okello", country: "UG", // Alpha-2 country code phoneNumber: "+256712345678", // Should be in international format bankAccountName: "John Okello", bankAccountNumber: "12345678", bankName: "Stanbic Bank", bankCode: 1234 // You can get the bank code from payouts.getDeliveryBanks() );
注意,如果不需要银行支付,所有银行字段都是可选的
删除收款人
$beneficiary = eversendClient.beneficiaries.delete( beneficiaryId: 100 );
集合
获取集合费用
$collectionFees = eversendClient.collections().getFees( amount: 1000, currency: "KES", method: "momo" );
获取集合OTP
在启动移动货币集合时需要
$collectionOTP = eversendClient.collections().getOTP( phone: "+256712345678" );
启动移动货币集合
eversendClient.collections().initiateMomo( phone: "+256712345678", amount: 1000, country: "UG", currency: "UGX", pin: 123456, // From phone number passed in Get Collection OTP pinId: "dg524fhsgfde", // From Get Collection OTP transactionRef: "EVS-12345678", // Optional transaction ref generated by you customer: { name: "John Okello" } // Optional customer object with your metadata );
支付
获取支付报价
$quotation = eversendClient.payouts.getQuotation( amount: 100, amountType: "SOURCE", // amountType can be SOURCE or DESTINATION sourceWallet: "USD", destinationCountry: "KE", destinationCurrency: "KES" );
amountType
表示您是否希望金额代表sourceWallet
(来源)或destinationCurrency
(目的地货币)
支付现有收款人
$payout = eversendClient.payouts.initiate( beneficiaryId: 100, quotationToken: "token", transactionRef: "EVS-12345678" // Optional transaction ref generated by you );
支付新收款人
$payout = eversendClient.payouts.initiate({ firstName: "John", lastName: "Okello", country: "UG", // Alpha-2 country code phoneNumber: "+256712345678", // Should be in international format bankAccountName: "John Okello", bankAccountNumber: "12345678", bankName: "Stanbic Bank", bankCode: 1234, // You can get the bank code from payouts.getDeliveryBanks() quotationToken: "token", transactionRef: "EVS-12345678" // Optional transaction ref generated by you });
获取送货国家
$countries = eversendClient.payouts.countries()
获取送货银行
$banks = eversendClient.payouts.banks( country: "UG" );
贡献指南
欢迎并鼓励贡献。更多关于我们的贡献指南请参阅这里
许可
MIT © Eversend