PHP code example of larrytech7 / omnipay-momocm

1. Go to this page and download the library: Download larrytech7/omnipay-momocm 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/ */

    

larrytech7 / omnipay-momocm example snippets


use Omnipay\Omnipay;

$gateway = Omnipay::create('Momoc');
$config = [
    'providerCallbackHost' =>'http://mycallback',
    'amount' => 100.00, //amount the client should pay
    'api_user' => '', //your provided profile apiuser
    'api_key' => '', //your provided profile api key
    'subscription_key' => '', //your provided subscription key
];

$gateway->authorize($config);
$response = $gateway->purchase($config)->send();

$transactionInfo = $response->getMessage(); //an array containing transaction data

if($response->isSuccessful()){
    //save transaction to database and notify the user
    //.....
}else{
    //get error from the message and notify the user
    //......
}