explicador / e2payments-php-sdk
MPesa、eMola、MKesh、移动账户、BIM、Master Card 等在线支付集成包
v1.0.4
2022-04-19 22:46 UTC
Requires
- php: >=7.3
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^9.3.3
This package is auto-updated.
Last update: 2024-09-20 04:03:45 UTC
README
此包旨在帮助 php 开发者轻松实现 e2Payments API。它基于 REST API,其文档可在 https://e2payments.explicador.co.mz/docs 上找到。
安装
您可以通过 composer 安装此包
composer require explicador/e2payments-php-sdk
用法
// Set the consumer key and consumer secret as follows $mpesa = new \Explicador\E2paymentsPhpSdk\Mpesa(); $mpesa->setClientId('your e2payments client id'); $mpesa->setClientSecret('your e2payments client secret'); $mpesa->setWalletId('your walletId from e2payments');// 'live' production environment //This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa. $result = $mpesa->c2b($phone_number, $amount, $reference);
示例
// Your variables // The e2payments is REST API based platform // find or create your credential from: https://e2payments.explicador.co.mz/admin/credentials $client_id = 'oQPGhzqyDRilpzvTT6g0nhSeomVQ9G7zZrvY4v00'; //you must change $client_secret = '961022ed-08f6-4980-a1b3-f017fd15b800'; //you must change // find your wallet_id from: https://e2payments.explicador.co.mz/admin/mpesa // or in the organizations where you were invited // The wallet_id starts by (#), insert here without (#) $wallet_id = '111111'; //you must change // SDK initiation for mpesa transaction $mpesa = new \Explicador\E2paymentsPhpSdk\Mpesa([ 'client_secret' => $client_secret, 'client_id' => $client_id, 'wallet_id' => $wallet_id, ]); //This creates transaction between an M-Pesa short code to a phone number registered on M-Pesa. $result = $mpesa->c2b($phone_number, $amount, $reference); echo var_dump($result);
常见 HTTP 状态码
测试
composer test
更新日志
有关最近更改的更多信息,请参阅 CHANGELOG。
贡献
有关详细信息,请参阅 CONTRIBUTING。
安全
如果您发现任何安全相关的问题,请通过电子邮件 developers@explicador.co.mz 而不是使用问题跟踪器。
致谢
许可协议
MIT 许可协议 (MIT)。有关更多信息,请参阅 许可文件。
PHP 包模板
此包是使用 PHP 包模板 生成的。