1. Go to this page and download the library: Download gemfourmedia/omnipay-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/ */
gemfourmedia / omnipay-momo example snippets
use Omnipay\Omnipay;
$gateway = Omnipay::create('MoMo');
$gateway->initialize([
'accessKey' => 'Provided by MoMo',
'partnerCode' => 'Provided by MoMo',
'secretKey' => 'Provided by MoMo',
]);
$response = $gateway->refund([
'orderId' => 'refund-10', //Note: orderId (new) of the refund transaction which must be different from orderId of the original purchase transaction
'requestId' => '1f60e60a-a78c-45c0-b6da-94d1855157ae',
'amount' => 2100,
'transId' => 2842402931,
'lang' => 'vi',
'description' => 'Example refund 10',
])->send();
if ($response->isSuccessful()) {
var_dump($response->getData());
} else {
print $response->getMessage();
}