1. Go to this page and download the library: Download hovakimyannn/omnipay-epg 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/ */
hovakimyannn / omnipay-epg example snippets
use Omnipay\Omnipay;
$gateway = Omnipay::create('Epg\Arca');
$gateway->setUsername('your_username');
$gateway->setPassword('your_password');
// $gateway->setTestMode(true); // use ipaytest.arca.am
use Omnipay\Epg\Gateway;
$gateway = new Gateway();
$gateway->setEndpoint('https://epg.yourbank.am/payment/rest');
$gateway->setTestEndpoint('https://epg-test.yourbank.am/payment/rest');
$gateway->setUsername('your_username');
$gateway->setPassword('your_password');
$response = $gateway->purchase([
'transactionId' => 'ORDER-001', // your order number
'amount' => '10.00',
'currency' => 'AMD',
'returnUrl' => 'https://yoursite.com/payment/success',
'failUrl' => 'https://yoursite.com/payment/fail', // optional
'description' => 'Order #001', // optional
'language' => 'en', // optional
'features' => 'FORCE_TDS', // optional: FORCE_SSL | FORCE_TDS
])->send();
if ($response->isRedirect()) {
// Store $response->getTransactionReference() (EPG orderId) for later status check
$orderId = $response->getTransactionReference();
$response->redirect(); // redirects customer to bank payment page
}
$response = $gateway->completePurchase([
'transactionId' => $orderId, // the EPG orderId saved during purchase
])->send();
if ($response->isSuccessful()) {
// Payment confirmed — fulfill the order
} else {
echo $response->getMessage();
}