PHP code example of masdimdev / omnipay-ipay88
1. Go to this page and download the library: Download masdimdev/omnipay-ipay88 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/ */
masdimdev / omnipay-ipay88 example snippets
$gateway = Omnipay::create('Ipay88');
$gateway->setMerchantCode('your-merchant-code');
$gateway->setMerchantKey('your-merchant-key');
$response = $gateway->purchase([
'transactionId' => 'ABC-12345',
'amount' => 100,
'description' => 'Test Product',
'userName' => 'John Doe',
'userEmail' => '[email protected] ',
'userContact' => '0123456789',
'returnUrl' => 'https://your-app.com/returnUrl',
'notifyUrl' => 'https://your-app.com/notifyUrl',
])->send();
if ($response->isRedirect()) {
$response->redirect(); // Redirect to iPay88 payment page
}
$response = $gateway->completePurchase()->send();
if ($response->isSuccessful()) {
echo 'Transaction successful';
} else {
echo 'Transaction failed';
}
$response = $gateway->requery([
'transactionId' => 'ABC-12345',
'amount' => 100,
])->send();
if ($response->isSuccessful()) {
echo 'Transaction successful: ' . $response->getMessage();
} else {
echo 'Transaction failed: ' . $response->getMessage();
}
$response = $gateway->requery([
'transactionId' => 'ABC-12345',
'amount' => 100,
])->send();
if ($response->isSuccessful()) {
echo 'Transaction successful: ' . $response->getMessage();
} else {
echo 'Transaction failed: ' . $response->getMessage();
}
$gateway->getPaymentIds();
print_r($paymentMethods);