PHP code example of foris-master / mtn-mobile-money-sdk
1. Go to this page and download the library: Download foris-master/mtn-mobile-money-sdk library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
foris-master / mtn-mobile-money-sdk example snippets
use Foris\MoMoSdk\Disbursement;
use Foris\MoMoSdk\Collection;
putenv('MOMO_CALLBACK_URL=https://myawesome.callback.com');
putenv('MOMO_CALLBACK_HOST=azz.com');
putenv('MOMO_ENV=mtncameroon');
putenv('MOMO_SDK_ENV=prod');
putenv('MOMO_CURRENCY=XAF');
Exemple Disbursement
$disbursement = new Disbursement();
$disbursement->getAccessToken();
$disbursement->transfer(100, '0123456789');
$transferData = $disbursement->transfer(100, '0123456789');
$transactionData = $disbursement->getTransaction('transaction_id');
$balance = $disbursement->getBalance();
$accountValidation = $disbursement->isAccountValid('0123456789');
Exemple Collection
$collection = new Collection();
$collection->getAccessToken();
$collection->requestToPay(100, '0123456789');
$collection-> getTransaction($id);
$collection->getBalance();
$collection->isAccountValid("0123456789")
use Foris\MoMoSdk\Disbursement;
$disbursement = new Disbursement();
$accessToken = $disbursement->getAccessToken();
use Foris\MoMoSdk\Disbursement;
$disbursement = new Disbursement();
$transferData = $disbursement->transfer(100, '0123456789');
use Foris\MoMoSdk\Disbursement;
$disbursement = new Disbursement();
$transactionData = $disbursement->getTransaction('transaction_id');
use Foris\MoMoSdk\Disbursement;
$disbursement = new Disbursement();
$balance = $disbursement->getBalance();
use Foris\MoMoSdk\Disbursement;
$disbursement = new Disbursement();
$accountValidation = $disbursement->isAccountValid('0123456789');
use Foris\MoMoSdk\Collection;
$collection = new Collection();
$accessToken = $collection->getAccessToken();
use Foris\MoMoSdk\CollectionCollection;
$collection = new CollectionCollection();
$requesPay = $collection->requestToPay(100, '0123456789');
use Foris\MoMoSdk\CollectionCollection;
$collection = new CollectionCollection();
$showTransaction = $collection->getTransaction($id);
use Foris\MoMoSdk\CollectionCollection;
$collection = new CollectionCollection();
$balance = $collection->getBalance();
use Foris\MoMoSdk\Collection;
$collection = new Collection();
$accountValidation = $collection->isAccountValid('0123456789');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.