/mesomb-php

PHP client for MeSomb

Primary LanguagePHP

Welcome to php-mesomb 👋

Version Documentation License: MIT Twitter: hachther

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:

  • curl, although you can use your own non-cURL client if you prefer
  • json
  • mbstring (Multibyte String)

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;
use MeSomb\Util\RandomGenerator;

$client = new PaymentOperation('<applicationKey>', '<AccessKey>', '<SecretKey>');
// MeSomb::setVerifySslCerts(false); if to want to disable ssl verification
$client->makeCollect([
    'amount' => 100,
    'service' => 'MTN',
    'payer' => '670000000',
    'nonce' => RandomGenerator::nonce(),
    'trxID' => '1'
]);

Depose money in an account

<?php
use MeSomb\Operation\PaymentOperation;
use MeSomb\Util\RandomGenerator;

$client = new PaymentOperation('<applicationKey>', '<AccessKey>', '<SecretKey>');
// MeSomb::setVerifySslCerts(false); if to want to disable ssl verification
$client->makeDeposit([
    'amount' => 100,
    'service' => 'MTN',
    'receiver' => '670000000',
    'nonce' => RandomGenerator::nonce(),
    'trxID' => '1'
]);

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;
use MeSomb\Util\RandomGenerator;

$client = new PaymentOperation('<applicationKey>', '<AccessKey>', '<SecretKey>');
$transactions = $client->getTransactions(['ID1', 'ID2']);
print_r($transactions);

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

Show your support

Give a ⭐️ if this project helped you!