1. Go to this page and download the library: Download nzokolab/mtnmomo 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/ */
nzokolab / mtnmomo example snippets
use Nzokolab\MtnMomo\Products\Collection;
$collection = new Collection();
$referenceId = $collection->requestToPay('yourTransactionId', '46733123454', 100);
use Nzokolab\MtnMomo\Products\Collection;
use Nzokolab\MtnMomo\Exceptions\CollectionRequestException;
try {
$collection = new Collection();
$referenceId = $collection->requestToPay('yourTransactionId', '46733123453', 100);
} catch(CollectionRequestException $e) {
do {
printf("\n\r%s:%d %s (%d) [%s]\n\r",
$e->getFile(), $e->getLine(), $e->getMessage(), $e->getCode(), get_class($e));
} while($e = $e->getPrevious());
}