1. Go to this page and download the library: Download leesiongchan/omnipay-molpay 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/ */
$response = $gateway->completePurchase($options)->send();
if ($response->isSuccessful()) {
// Do something
echo $response->getTransactionReference();
} elseif ($response->isPending()) {
// Do something
} else {
// Error
}
$gateway = Omnipay::create('MOLPay');
$gateway->setMerchantId('your_merchant_id');
$gateway->setVerifyKey('your_verify_key');
$gateway->setSecretKey('your_secret_key');
$request = $gateway->void([
'transactionReference' => '25248208'
]);
$response = $request->send();
if ($response->isSuccessful()) {
// Update your data model
} else {
echo $response->getMessage();
}
$gateway = Omnipay::create('MOLPay');
$gateway->setMerchantId('your_merchant_id');
$gateway->setVerifyKey('your_verify_key');
$gateway->setSecretKey('your_secret_key');
$request = $gateway->refund([
'transactionReference' => '25248208',
'refId' => 'merchant_refund_red_id',
'amount' => '10.00',
'channel' => $transaction_channel, // data saved from $gateway->purchase() response, e.g FPX_MB2U
'bankCode' => $bank_code, // from user who request to refund
'beneficiaryName' => $beneficiary_name, // from user who request to refund
'beneficiaryAccountNo' => $beneficiary_account_no, // from user who request to refund
]);
$response = $request->send();
// The refund process will take about 7-14 days after the request sent
if ($response->isSuccessful() || $response->isPending() ) {
// Update your data model
} else {
echo $response->getMessage();
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.