malico / laravel-mesomb
This package is abandoned and no longer maintained.
No replacement package was suggested.
A laravel wrapper on top of Mesomb Payment API
1.6
2023-07-22 18:24 UTC
Requires
- php: ^8.0
- guzzlehttp/guzzle: ^7.0|^8.0|^9.0
- illuminate/database: ^7.0|^8.0|^9.0|^10.0
- illuminate/support: ^7.0|^8.0|^9.0|^10.0
- malico/mobile-cm-php: ^1.2
Requires (Dev)
- laravel/pint: ^1.10
- orchestra/testbench: ^7.0|^8.0
- pestphp/pest: ^1.19
- pestphp/pest-plugin-laravel: ^1.1
- spatie/ray: ^1.30
This package is auto-updated.
Last update: 2024-02-22 19:55:01 UTC
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