1. Go to this page and download the library: Download arm092/omnipay-ameriabank 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/ */
arm092 / omnipay-ameriabank example snippets
use Omnipay\Omnipay;
$gateway = Omnipay::create('Ameria');
$gateway->setClientId(env('AMERIA_CLIENT_ID'));
$gateway->setUsername(env('AMERIA_USERNAME'));
$gateway->setPassword(env('AMERIA_PASSWORD'));
$gateway->setTestMode(true); // false for production; use the same mode on completion
$response = $gateway->purchase([
'transactionId' => '123', // Your unique numeric order ID
'amount' => '10.25', // Major currency units, never multiply by 100
'currency' => 'AMD',
'description' => 'Order 123',
'returnUrl' => env('AMERIA_RETURN_URL'),
'opaque' => json_encode(['order_id' => 123]),
])->send();
if ($response->isRedirect()) {
// Persist this bank ID against your local order before redirecting.
$paymentId = $response->getTransactionReference();
$response->setLanguage('en'); // am, ru, en
$response->redirect();
} else {
// Registration failed. Inspect getCode() and getMessage().
}
// $gateway must have the same credentials and test mode as registration.
// $storedPaymentId is the PaymentID saved for the local order.
$response = $gateway->completePurchase([
'transactionReference' => $storedPaymentId,
])->send();
if ($response->isSuccessful()) {
// OrderStatus=2 and ResponseCode=00.
// Match OrderID, Amount and Currency from getData() to the stored order.
// Mark the order paid idempotently in your application.
}