malico/laravel-mesomb
最新稳定版本:1.6
Composer 安装命令:
composer require malico/laravel-mesomb
包简介
A laravel wrapper on top of Mesomb Payment API
README 文档
README
Laravel Wrapper on top of MeSomb Payment API
Roadmap
API Features and their implementations https://mesomb.hachther.com/en/api/schema/
| Feature | Status |
|---|---|
| Payment | ☑ |
| Transaction Status | ☑ |
| Application Status | ☑ |
| Deposits | ☑ |
| Test | ☐ |
| Better Documentation | ☐ |
Installation
Install Package
composer require malico/laravel-mesomb
Publish Configuration Files
php artisan vendor:publish --tag=mesomb-configuration
Sign up and Create new Application at https://mesomb.hachther.com/. Provide appropriate from your dashboard configure for the config/mesomb.php;
<?php return [ /** * Api Version * * @var string */ 'version' => 'v1.0', /** * MeSomb Application Key * Copy from https://mesomb.hachther.com/en/applications/{id} * * @var string */ 'key' => env('MeSomb_APP_KEY'), /** * MeSomb API Application Key * Copy from https://mesomb.hachther.com/en/applications/{id} * * @var string */ 'api_key' => env('MeSomb_API_KEY'), /** * PIN used for MeSomb Pin * Configure @ https://mesomb.hachther.com/en/applications/{id}/settings/setpin/ * * @var int|string */ 'pin' => env('MeSomb_PIN', null), /** * Supported Payment Methods * * @var array */ 'currencies' => ['XAF', 'XOF'], /** * Support Payment Methods * Array in order of preference * * @var array */ 'services' => ['MTN', 'ORANGE'], /** * Set to True if your application uses uuid instead auto-incrmenting ids * * @var bool */ 'uses_uuid' => false, /* * Used to store the application Status */ 'application_cache_key' => 'mesomb_application_status', /* * You can choose to wait till the application to wait till the payment is approved * or queue the payment request check later * enum: asynchronous, synchronous */ 'mode' => 'synchronous', 'throw_exceptions' => true, ];
Migrate Mesomb Transaction Tables
php artisan migrate
Usage
Payments
Examples
-
Simple Payments
// OrderController.php use Malico\MeSomb\Payment; class OrderController extends Controller { public function confirmOrder() { $request = new Payment('+23767xxxxxxx', 1000); $payment = $request->pay(); if($payment->success){ // Fire some event,Pay someone, Alert user } else { // fire some event, redirect to error page } // get Transactions details $payment->transactions } }
-
Attaching Payments to Models Directly
// Order.php use Malico\MeSomb\Helper\HasPayments; class Order extends Model { use HasPayments; } // OrderController.php class OrderController extends Controller { public function confirmOrder(){ $order = Order::create(['amount' => 100]); $payment = $order->payment('+23767xxxxxxx', $order->amount)->pay(); if($payment->success){ // Fire some event,Pay someone, Alert user } else { // fire some event, redirect to error page } // View Order payments via $order->payments // Get payment transaction with $payment->transaction return $payment; } }
Author
Malico (Desmond Yong) hi@malico.me
统计信息
- 总下载量: 865
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 7
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-12