hachther / mesomb-php
MeSomb PHP Library
Installs: 2 061
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 2
Forks: 0
Open Issues: 0
pkg:composer/hachther/mesomb-php
Requires
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- ext-openssl: *
Requires (Dev)
- phpdocumentor/shim: ^3.6
- phpunit/phpunit: ^9.5
README
PHP client for MeSomb services.
You can check the full documentation of the api here
🏠 Requirements
PHP 5.6.0 and later.
Composer
You can install the bindings via Composer. Run the following command:
composer require hachther/mesomb-php
To use the bindings, use Composer's autoload:
require_once 'vendor/autoload.php';
Manual Installation
If you do not wish to use Composer, you can download the latest release. Then, to use the bindings, include the init.php file.
require_once '/path/to/mesomb-php/init.php';
Dependencies
The bindings require the following extensions in order to work properly:
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
Getting Stated
Collect money from an account
<?php use MeSomb\Operation\PaymentOperation; $applicationKey = 'application key'; $accessKey = 'access key'; $secretKey = 'secret key'; $client = new PaymentOperation($applicationKey, $accessKey, $secretKey); $response = $client->makeCollect([ 'payer' => '670000000', 'amount' => 10000, 'service' => 'MTN', 'country' => 'CM', 'currency' => 'XAF', 'customer' => [ 'email' => 'email@gmail.com', 'first_name' => 'Dan', 'last_name' => 'Fisher', 'town' => 'Douala', 'region' => 'Littoral', 'country' => 'CM', 'address' => 'Bepanda', ], 'products' => [ [ 'id' => 'SKU001', 'name' => 'Sac a Dos', 'category' => 'Sac', 'quantity' => 1, 'amount' => 10000 ] ], 'location' => [ 'town' => 'Douala', 'region' => 'Littoral', 'country' => 'CM' ] ]); $response->isOperationSuccess(); $response->isTransactionSuccess();
Depose money in an account
<?php use MeSomb\Operation\PaymentOperation; $applicationKey = 'application key'; $accessKey = 'access key'; $secretKey = 'secret key'; $client = new PaymentOperation($applicationKey, $accessKey, $secretKey); $response = $client->makeDeposit([ 'receiver' => '670000000', 'amount' => 10000, 'service' => 'MTN', 'country' => 'CM', 'currency' => 'XAF', 'customer' => [ 'email' => 'email@gmail.com', 'first_name' => 'Dan', 'last_name' => 'Fisher', 'town' => 'Douala', 'region' => 'Littoral', 'country' => 'CM', 'address' => 'Bepanda', ], 'products' => [ [ 'id' => 'SKU001', 'name' => 'Sac a Dos', 'category' => 'Sac', 'quantity' => 1, 'amount' => 10000 ] ], 'location' => [ 'town' => 'Douala', 'region' => 'Littoral', 'country' => 'CM' ] ]); $response->isOperationSuccess(); $response->isTransactionSuccess();
Get application status
<?php use MeSomb\Operation\PaymentOperation; use MeSomb\Util\RandomGenerator; $client = new PaymentOperation('<applicationKey>', '<AccessKey>', '<SecretKey>'); $application = $client->getStatus(); print_r($application->getStatus()); print_r($application->getBalance());
Get transactions by ids
<?php use MeSomb\Operation\PaymentOperation; $applicationKey = 'application key'; $accessKey = 'access key'; $secretKey = 'secret key'; $client = new PaymentOperation($applicationKey, $accessKey, $secretKey); $response = $client->getTransactions(['a483a9e8-51d7-44c9-875b-1305b1801274']); print_r($response);
Legacy Version Support
PHP 5.4 & 5.5
If you are using PHP 5.4 or 5.5, you should consider upgrading your environment as those versions have been past end of life since September 2015 and July 2016 respectively. Otherwise, you can still use MeSomb by downloading mesomb-php 3.1.0 (zip, tar.gz) from our releases page. This version will work but might not support recent features we added since the version was released and upgrading PHP is the best course of action.
Documentation
Payment
All API related to the payment service available in MeSomb\Operation\PaymentOperation
| Method | Endpoint | Description |
|---|---|---|
| makeCollect | payment/collect/ | Collect money from a mobile account |
| makeDeposit | payment/deposit/ | Make a deposit in a receiver mobile account |
| updateSecurity | payment/security/ | Update security settings of your service on MeSomb |
| getStatus | payment/status/ | Get the current status of your service on MeSomb |
| getTransactions | payment/transactions/ | Get transactions from MeSomb by IDs. |
Author
👤 Hachther LLC contact@hachther.com
- Website: https://www.hachther.com
- Twitter: @hachther
- Github: @hachther
- LinkedIn: @hachther
Show your support
Give a ⭐️ if this project helped you!