1. Go to this page and download the library: Download bmatovu/laravel-mtn-momo 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/ */
bmatovu / laravel-mtn-momo example snippets
use Bmatovu\MtnMomo\Products\Collection;
$collection = new Collection();
$referenceId = $collection->requestToPay('yourTransactionId', '46733123454', 100);
use Bmatovu\MtnMomo\Products\Collection;
use Bmatovu\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());
}