By integrating our API, you will be able to interact with our payment gateway, securely transmitting payment requests and receiving responses in real-time.

Payment Process Environment

🚧

Sandbox Environment

All operations conducted in this environment are considered as trial transaction.

Store ID : aamarpaytest

Signature Key : dbb74894e82415a2f7ff0ec3a97e4183

Live Environment

Please note that all transactions carried out in this environment are considered authentic, and the URL begins with https://secure.aamarpay.com

ℹ️

Obtain Live Credentials

For acquiring the necessary live credentials to process payments, please don't hesitate to contact our Support Team at [email protected]. They are readily available to guide you throughout the procedure and provide the essential credentials to facilitate live payment transactions on your platform.

🌐

API Endpoints

API Endpoint (Sandbox Environment) : https://sandbox.aamarpay.com/jsonpost.php

API Endpoint (Live Environment) : https://secure.aamarpay.com/jsonpost.php

Method : POST

Request Parameters

PropertyRequiredTypeDescription
store_idYesStringYour Merchant ID – Provided by aamarPay (Example: aamarpaytest)
signature_keyYesStringYou will need to provide the Signature Key issued by aamarPay, which serves as a unique authentication key. (Example: dbb74894e82415a2f7ff0ec3a97e4183 )
tran_idYesStringThe identification number or order ID, or invoice number, given by the merchant, is unique for each payment transaction. The maximum allowed length for this identifier is 32 characters.
amountYesDecimalEnsure that you input the total amount you wish to pay for the transaction. Do not include any currency symbols or commas. The amount should be a numerical value only. If there are decimals, use a period (.) as the decimal separator. For example, if your payment amount is $50.99, simply enter '50.99' in the field.
currencyYesStringThe currency field should only contain uppercase letters corresponding to the desired currency (e.g., "USD" or "BDT").
descYesStringThe description field allows the payer to provide additional information or notes related to the payment. It is an opportunity to add context or details about the purpose of the transaction.
cus_nameYesStringCustomer Full Name
cus_emailYesStringEmail address of the customer who is making the payment.
cus_phoneYesStringPhone number of the customer who is making the payment.
success_urlYesStringThe success_url is the designated URL to which the payment gateway will redirect customers after a successful payment transaction. When the customer completes the payment process, the payment gateway will initiate a POST request to the success_url to notify your system about the successful transaction and share the relevant payment details.
fail_urlYesStringThe fail_url is the designated URL to which the payment gateway will redirect customers after a failed payment transaction. When the customer completes the payment process, the payment gateway will initiate a POST request to the fail_url to notify your system about the failed transaction and share the relevant payment details.
cancel_urlYesStringURL to return customers to your product page or home page.
typeYesStringThe value of this parameter is always "json".
cus_add1NoStringCustomer’s address (e.g. street)
cus_add2NoStringCustomer’s address (e.g. town)
cus_cityNoStringCustomers city
cus_stateNoStringCustomer state or region
cus_countryNoStringCustomer Country
opt_aNoStringOptional Parameter 1 ( you can get this data from gateway callback response)
opt_bNoStringOptional Parameter 2 ( you can get this data from gateway callback response)
opt_cNoStringOptional Parameter 3 ( you can get this data from gateway callback response)
opt_dNoStringOptional Parameter 4 ( you can get this data from gateway callback response)

Sample Request

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
  CURLOPT_URL => 'https://​sandbox​.aamarpay.com/jsonpost.php',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => '',
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 0,
  CURLOPT_FOLLOWLOCATION => true,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => 'POST',
  CURLOPT_POSTFIELDS =>'{
    "store_id": "aamarpaytest",
    "tran_id": "123123173",
    "success_url": "http://www.merchantdomain.com/suc esspage.html",
    "fail_url": "http://www.merchantdomain.com/faile dpage.html",
    "cancel_url": "http://www.merchantdomain.com/can cellpage.html",
    "amount": "10.0",
    "currency": "BDT",
    "signature_key": "dbb74894e82415a2f7ff0ec3a97e4183",
    "desc": "Merchant Registration Payment",
    "cus_name": "Name",
    "cus_email": "[email protected]",
    "cus_add1": "House B-158 Road 22",
    "cus_add2": "Mohakhali DOHS",
    "cus_city": "Dhaka",
    "cus_state": "Dhaka",
    "cus_postcode": "1206",
    "cus_country": "Bangladesh",
    "cus_phone": "+8801704",
    "type": "json"
}',
  CURLOPT_HTTPHEADER => array(
    'Content-Type: application/json'
  ),
));

$response = curl_exec($curl);

curl_close($curl);
echo $response;

import requests
import json

url = "https://​sandbox​.aamarpay.com/jsonpost.php"

payload = json.dumps({
  "store_id": "aamarpaytest",
  "tran_id": "123123173",
  "success_url": "http://www.merchantdomain.com/suc esspage.html",
  "fail_url": "http://www.merchantdomain.com/faile dpage.html",
  "cancel_url": "http://www.merchantdomain.com/can cellpage.html",
  "amount": "10.0",
  "currency": "BDT",
  "signature_key": "dbb74894e82415a2f7ff0ec3a97e4183",
  "desc": "Merchant Registration Payment",
  "cus_name": "Name",
  "cus_email": "[email protected]",
  "cus_add1": "House B-158 Road 22",
  "cus_add2": "Mohakhali DOHS",
  "cus_city": "Dhaka",
  "cus_state": "Dhaka",
  "cus_postcode": "1206",
  "cus_country": "Bangladesh",
  "cus_phone": "+8801704",
  "type": "json"
})
headers = {
  'Content-Type': 'application/json'
}

response = requests.request("POST", url, headers=headers, data=payload)

print(response.text)

Sample Response

{
    "result": "true",
    "payment_url": "https://sandbox.aamarpay.com/paynow.php?track=AAM1690275828103929"
}

Ensure that the URL redirection to the payment gateway is implemented correctly in your application.

After a transaction is completed, whether it is successful or has failed, the gateway will redirect to your designated success or failure URL. This redirection will include a response containing relevant information.

Sample Response After Redirection

{
    "pg_service_charge_bdt": "2",
    "amount_original" : "100",
    "gateway_fee": "" ,
    "pg_service_charge_usd":"Not-Available" ,
    "pg_card_bank_name":"Not Available", 
    "pg_card_bank_country":"Not Available", 
    "card_number": "1234XXXXXXXXX123", 
    "card_holder": "" ,
    "status_code": "2" ,
    "pay_status": "Successful" ,
    "success_url": "http://localhost:3000/success.php", 
    "fail_url": "http://localhost:3000/fail.php", 
    "cus_name": "Customer Name", 
    "cus_email": "[email protected]" ,
    "cus_phone": "0178273****", 
    "currency_merchant": "USD", 
    "convertion_rate": "109.57", 
    "ip_address": "XXX.XXX.XXX.XX" ,
    "other_currency": "40.00" ,
    "pg_txnid": "AAM1694948761103545" ,
    "epw_txnid": "AAM1694948761103545" ,
    "mer_txnid": "test1599957", 
    "store_id": "aamarpaytest" ,
    "merchant_id": "aamarpaytest" ,
    "currency": "BDT", 
    "store_amount": "4240.36" ,
    "pay_time": "2023-09-17 17:06:08", 
    "amount":  "4382.80" ,
    "bank_txn": "1094621001640" ,
    "card_type": "DBBL-VISA", 
    "reason": "Not Available", 
    "pg_card_risklevel": "0" ,
    "pg_error_code_details": "Not Available" ,
    "opt_a":"" ,
    "opt_b": "", 
    "opt_c": "" ,
    "opt_d": ""
}

Response Parameters Details

PropertyDescription
pg_service_charge_bdtThe service charge for the payment gateway is calculated in Bangladeshi Taka (BDT).
amount_originalThe amount paid by the customer in Bangladeshi Taka (BDT).
status_codeA status code of 2 signifies a successful transaction, whereas a status code of 7 indicates a failed transaction.
pay_statusThe payment status in text format (e.g., Successful or Failed).
success_urlThe success_url is the designated URL to which the payment gateway will redirect customers after a successful payment transaction. When the customer completes the payment process, the payment gateway will initiate a POST request to the success_url to notify your system about the successful transaction and share the relevant payment details.
fail_urlThe fail_url is the designated URL to which the payment gateway will redirect customers after a failed payment transaction. When the customer completes the payment process, the payment gateway will initiate a POST request to the fail_url to notify your system about the failed transaction and share the relevant payment details.
cus_nameCustomer Full Name
cus_emailEmail address of the customer who is making the payment.
cus_phonePhone number of the customer who is making the payment.
currency_merchantThis refers to the currency that you have forwarded to the payment gateway.
convertion_rateIf you submit currency in USD to the gateway, you are aware of the conversion rate from this end.
pg_txnidThis is the unique transaction ID provided by the Payment Gateway for each transaction.
mer_txnidThe unique transaction ID which is created on merchant end
store_idUnique ID for every merchant
merchant_idUnique ID for every merchant
currencyThis field will provide information about in which currency the customer has paid the money
store_amountAfter deducting the payment gateway charge, this amount will the merchant get.
pay_timePayment Time
amountThe amount the customer has paid
bank_txnBank Transaction Number
card_typeThe customer has used which medium to pay
reasonIf the transaction failed on the bank end and they send any response then you will get it here
pg_card_risklevelPayment gateway card risk level (no risk = 0)
pg_error_code_detailsIf payment fails in the payment gateway end then you will get the reason here
opt_aOptional Parameter 1 ( you can get this data from the gateway callback response)
opt_bOptional Parameter 2 ( you can get this data from the gateway callback response)
opt_cOptional Parameter 3 ( you can get this data from gateway callback response)
opt_dOptional Parameter 4 ( you can get this data from gateway callback response)

🔍

It is preferred that in your success endpoint, you utilize our search transaction API.

Search Transection API

Sample Code

📘

Please ensure that you have completed the necessary steps to enable aamarPay on your aamarPay account and obtained the required Store ID and Signature key before switching to live mode. Please reach out to Support team for assistance.

If you encounter any issues during the integration process, please reach out to Integration support team for assistance.