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.
Base URL : https://sandbox.aamarpay.com
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
Property | Required | Type | Description |
---|---|---|---|
store_id | Yes | String | Your Merchant ID – Provided by aamarPay (Example: aamarpaytest) |
signature_key | Yes | String | You will need to provide the Signature Key issued by aamarPay, which serves as a unique authentication key. (Example: dbb74894e82415a2f7ff0ec3a97e4183 ) |
tran_id | Yes | String | The 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. |
amount | Yes | Decimal | Ensure 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. |
currency | Yes | String | The currency field should only contain uppercase letters corresponding to the desired currency (e.g., "USD" or "BDT"). |
desc | Yes | String | The 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_name | Yes | String | Customer Full Name |
cus_email | Yes | String | Email address of the customer who is making the payment. |
cus_phone | Yes | String | Phone number of the customer who is making the payment. |
success_url | Yes | String | The 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_url | Yes | String | The 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_url | Yes | String | URL to return customers to your product page or home page. |
type | Yes | String | The value of this parameter is always "json". |
cus_add1 | No | String | Customer’s address (e.g. street) |
cus_add2 | No | String | Customer’s address (e.g. town) |
cus_city | No | String | Customers city |
cus_state | No | String | Customer state or region |
cus_country | No | String | Customer Country |
opt_a | No | String | Optional Parameter 1 ( you can get this data from gateway callback response) |
opt_b | No | String | Optional Parameter 2 ( you can get this data from gateway callback response) |
opt_c | No | String | Optional Parameter 3 ( you can get this data from gateway callback response) |
opt_d | No | String | Optional 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
Check The "status_code" field and "amount" field
Property | Description |
---|---|
pg_service_charge_bdt | The service charge for the payment gateway is calculated in Bangladeshi Taka (BDT). |
amount_original | The amount paid by the customer in Bangladeshi Taka (BDT). |
status_code | A status code of 2 signifies a successful transaction, whereas a status code of 7 indicates a failed transaction. |
pay_status | The payment status in text format (e.g., Successful or Failed). |
success_url | The 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_url | The 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_name | Customer Full Name |
cus_email | Email address of the customer who is making the payment. |
cus_phone | Phone number of the customer who is making the payment. |
currency_merchant | This refers to the currency that you have forwarded to the payment gateway. |
convertion_rate | If you submit currency in USD to the gateway, you are aware of the conversion rate from this end. |
pg_txnid | This is the unique transaction ID provided by the Payment Gateway for each transaction. |
mer_txnid | The unique transaction ID which is created on merchant end |
store_id | Unique ID for every merchant |
merchant_id | Unique ID for every merchant |
currency | This field will provide information about in which currency the customer has paid the money |
store_amount | After deducting the payment gateway charge, this amount will the merchant get. |
pay_time | Payment Time |
amount | The amount the customer has paid |
bank_txn | Bank Transaction Number |
card_type | The customer has used which medium to pay |
reason | If the transaction failed on the bank end and they send any response then you will get it here |
pg_card_risklevel | Payment gateway card risk level (no risk = 0) |
pg_error_code_details | If payment fails in the payment gateway end then you will get the reason here |
opt_a | Optional Parameter 1 ( you can get this data from the gateway callback response) |
opt_b | Optional Parameter 2 ( you can get this data from the gateway callback response) |
opt_c | Optional Parameter 3 ( you can get this data from gateway callback response) |
opt_d | Optional 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.
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.