afrikpay-tools / afrikpay-tools-php-sdk
Afrikpay Php Api Sdk
dev-master
2021-05-27 16:58 UTC
Requires
- php: >=7.0.0
- guzzlehttp/guzzle: ^7.2
This package is not auto-updated.
Last update: 2024-09-27 09:24:23 UTC
README
Afrikpay Node Sdk
Afrikpay 与 nodejs 的 api 集成
探索文档
查看演示 · 报告错误 · 请求功能
入门
这个 node 库的创建目的是为了方便我们的支付 api 与我们的合作伙伴集成。这是一项持续的工作。欢迎提出改进 api 的建议。
先决条件:系统上必须安装 composer
安装
composer require afrikpay-tools/afrikpay-tools-php-sdk:dev-master
电子商务集成
假设您想在系统中集成电子商务支付。以下是开发环境中完成此任务的两个主要步骤。您可以取消注释代码以测试其他 api。
require __DIR__.'/vendor/autoload.php';
use App\Ecommerce;
//some example usage of the package
/*********************ecommerce api examples****************/
//collect example
$ecommerce = new Ecommerce(
'AFC6617',
'661671d0bd7bef499e7d80879c27d95e',
'7777',
'http://34.86.5.170:8086/api/ecommerce/collect/',
'http://34.86.5.170:8086/api/ecommerce/payout/',
'http://34.86.5.170:8086/api/ecommerce/deposit/',
'http://34.86.5.170:8086/api/ecommerce/changekey/',
'http://34.86.5.170:8086/api/ecommerce/transaction/status/'
);
$response = $ecommerce->collect(
'mtn_mobilemoney_cm',
'677777777',
400);
$ecommerce->print_response($response);
// $response = $ecommerce->collect(
// 'orange_money_cm',
// '699999999',
// 400,
// '0000',
// '123azerty');
// $ecommerce->print_response($response);
//payout example
// $response = $ecommerce->payout(
// 'mtn_mobilemoney_cm',
// '677777777',
// 300);
// $ecommerce->print_response($response);
// $response = $ecommerce->payout(
// 'orange_money_cm',
// '699999999',
// 500);
// $ecommerce->print_response($response);
//balance deposit example
// $response = $ecommerce->deposit();
// $ecommerce->print_response($response);
//transaction status example
// $response = $ecommerce->transactionStatus('123azerty');
// $ecommerce->print_response($response);
//ecommerce hash
// $hash = $ecommerce->hash('ecommerce_collect');
// print_r($hash);
账单集成
如果您想在系统中集成账单支付 api,以下是开发环境中完成此任务的两个主要步骤。您可以取消注释代码以测试其他 api。
require __DIR__.'/vendor/autoload.php';
use App\Bill;
//bill example
$bill = new Bill(
'3620724907638658',
'3620724907638658',
'e825e83873eafffff315fc3f22db2d59',
'afrikpay',
'http://34.86.5.170:8086/api/bill/v2/',
'http://34.86.5.170:8086/api/bill/getamount/',
'http://34.86.5.170:8086/api/bill/status/v2/'
);
$response = $bill->payBill(
'camwater',
'111111111111111',
2000,
'cash',
'16589'
);
$bill->print_response($response);
// $response = $bill->payBill(
// 'canal',
// '11111111111111',
// 13500,
// 'cash',
// '165899'
// );
// $bill->print_response($response);
// $response = $bill->getBillAmount(
// 'canal',
// '11111111111111'
// );
// $bill->print_response($response);
// $response = $bill->getBillStatus(
// '165899'
// );
// $bill->print_response($response);
空中时间集成
如果您想在系统中集成空中时间 api,以下是开发环境中完成此任务的两个主要步骤。您可以取消注释代码以测试其他 api。
require __DIR__.'/vendor/autoload.php';
use App\Airtime;
//airtime example
$airtime = new Airtime(
'3620724907638658',
'3620724907638658',
'e825e83873eafffff315fc3f22db2d59',
'afrikpay',
'http://34.86.5.170:8086/api/airtime/v2/',
'http://34.86.5.170:8086/api/airtime/status/v2/'
);
//airtime status
$response = $airtime->makeAirtime(
'mtn',
'677777777',
1000,
'cash',
'xyz123'
);
$airtime->print_response($response);
// $response = $airtime->airtimeStatus(
// 'xyz123'
// );
// $airtime->print_response($response);
账户集成
如果您想在系统中集成账户 api,以下是开发环境中完成此任务的两个主要步骤。您可以取消注释代码以测试其他 api。
require __DIR__.'/vendor/autoload.php';
use App\Account;
$account = new Account(
'3620724907638658',
'3620724907638658',
'e825e83873eafffff315fc3f22db2d59',
'http://34.86.5.170:8086/api/account/agent/balance/v2/',
'http://34.86.5.170:8086/api/account/agent/balance/v2/',
'http://34.86.5.170:8086/api/account/developer/changekey/'
);
$response = $account->balance();
$account->print_response($response);
如何切换到生产环境?
您可以探索 src 文件夹以查看默认的生产设置。只需使用适当的生产环境 apikey、存储代码、agentid 即可。如果您在使用库时遇到任何问题,请与我们联系,我们将很乐意帮助您。
许可证
在 MIT 许可下分发。有关更多信息,请参阅 LICENSE
。
联系
项目链接: https://github.com/Georges-Ngandeu/AfrikpayNodeSdk