ngambmicheal / mobilemoney
"通过移动货币服务提供支付服务,支持Laravel的MTN Mobile Money和Orange Money "
1.0.2
2017-08-05 03:48 UTC
This package is not auto-updated.
Last update: 2024-09-29 00:46:30 UTC
README
packages/ngambmicheal/mobilemoney
移动货币是一种支付服务,您可以在应用程序中集成,以通过MTN Mobile Money和Orange Money等移动货币提供商进行支付
- 喀麦隆Mtn移动货币
- 喀麦隆Orange Money
快速开始
应用密钥
在使用此API之前,您必须从Webshinobis获取客户端密钥和密钥。您可以通过我们的网站联系我们
设置
更新您的composer.json文件,并在require键下添加以下内容
"ngambmicheal/mobilemoney": "dev-master"
运行composer update命令
$ composer update
或者,您仍然可以运行以下命令
$ composer require ngambmicheal/mobilemoney
在您的config/app.php中,将'Ngambmicheal\MobileMoney\MobileMoneyProvider'添加到$providers数组的末尾
'providers' => array(
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'Ngambmicheal\MobileMoney\MobileMoneyProvider',
),
仍然在config/app.php中,将'MobileMoney' => 'Ngambmicheal\MobileMoney\MobileMoney'添加到$aliases数组中
'aliases' => array(
'App' => 'Illuminate\Support\Facades\App',
'Artisan' => 'Illuminate\Support\Facades\Artisan',
...
'MobileMoney' => 'Ngambmicheal\MobileMoney\MobileMoney',
),
运行下面的artisan命令以发布配置文件
$ php artisan vendor:publish
导航到app/config/mobilemoney.php并更新所有四个参数
配置
在config/mobilemoney.php文件中
return [ ... /* Your client key */ 'webshinobis_client_key'=>'', //Change this to your client key /* Your secret key */ 'webshinobis_secret_key'=>'', //Change this to your secret key /* Do you want your app to support MTN mobile services? Default : true */ 'mtn_mobile_money' => true, ];
示例
// doing an mtn mobile money transaction; use MobileMoney; class MomoController extends controller { public function doMoMo($request){ $phone = $request->phone; $price = $request->price; // do a mobile money transaction $mobilemoney = new MobileMoney; $mobilemoney->phone = $phone; $mobilemoney->price = $price; // you can overide your client and secret key $mobilemoney->setClientKey($client_key); $mobilemoney->setSecretKey($secret_key); // perform the transaction; $momo = $mobilemoney->doMTNTransaction(); if($momo->state){ //transaction was successful return $momo; /* $momo = (object) [ 'transaction_id' => '12345678', 'state' => true, 'status' => 'success', 'message' => 'Transaction Was successfull ...', 'phone' => '237678140682', 'price' => '1500' ]; */ } else{ //transaction faile $momo = (object) [ 'message' => 'Transaction failed ...', 'state' => false, 'status' => 'failure' ]; } } }
许可协议
在MIT许可证下发布,请参阅LICENSE。
附加信息
有任何问题,请随时联系我。
有任何问题,请在此处报告