razor-informatics / dpo-php
DPO Group 支付网关 PHP SDK。使用 API 支付选项。无需网页或重定向即可轻松使用 API
v0.1.1
2023-01-19 07:19 UTC
Requires
- php: >=7.1
- ext-curl: *
- ext-json: *
- ext-simplexml: *
README
DPO Group 支付网关包装器。使用 API 支付选项。无需网页或重定向即可轻松使用 API
开发支持
如果您在开发过程中需要支持,或者您需要一个开发团队,请联系我们。
文档
要获取 API 的详细信息,请查看API 文档。
安装
您可以通过 composer 或下载源代码来安装 PHP SDK
通过 Composer
安装 SDK 的推荐方式是使用 Composer。
composer require razor-informatics/dpo-php
获取账户余额
use RazorInformatics\DPOPhp; $companyToken = 'YOUR_COMPANY_TOKEN'; $dpo = new DPOPhp($companyToken); $results = $dpo->account()->balance('USD') print_r($results);
使用交易令牌验证交易
如何验证令牌
use RazorInformatics\DPOPhp; $companyToken = 'YOUR_COMPANY_TOKEN'; $dpo = new DPOPhp($companyToken); $transactionToken = 'TRANSACTION_TOKEN_GIVEN'; $results = $dpo->token()->verify($transactionToken) print_r($results);
卡支付
直接进行卡支付。
use RazorInformatics\DPOPhp; $companyToken = 'YOUR_COMPANY_TOKEN'; $serviceType = 5525; //SERVICE TYPE $paymentAmount = 500; $reference ="INV-1000"; $cardNumber = 5436886269848367 $cardExpiry = 1224;// format My example 0123 i.e. January 2023 $cardCvv = 123; $customerFirstName='John'; $customerLastName = 'Doe'; $customerPhone =''; $customerEmail = ''; $currency = 'USD'; $description = 'Flight booking for 5th January 2032' $dpo = new DPOPhp($companyToken); $results = $dpo->payment()->card($reference,$serviceType,$paymentAmount,$cardNumber,$cardExpiry,$cardCvv, $customerFirstName,$customerLastName,$customerPhone,$customerEmail,$currency,$description) print_r($results);
Mpesa 支付
直接进行 mpesa 支付,货币为 KES(肯尼亚先令)。在结果中会有交易令牌,使用它来验证支付是否成功。
use RazorInformatics\DPOPhp; $companyToken = 'YOUR_COMPANY_TOKEN'; $serviceType = 5525; //SERVICE TYPE $reference ="INV-1000"; $paymentAmount = 500; $customerFirstName='John'; $customerLastName = 'Doe'; $customerPhone = 2547100100100; $customerEmail = ''; $description = 'Flight booking for 5th January 2032' $dpo = new DPOPhp($companyToken); $results = $dpo->payment()->chargeMpesa($reference,$serviceType,$paymentAmount, $customerFirstName,$customerLastName,$customerPhone,$customerEmail,$description) print_r($results);
请记住验证交易代码以确认支付是否成功。
许可证
本软件包是开源软件,许可协议为 MIT 许可协议。