This API will receive a payment creation request with necessary information.
Introduction
The AstimPay Create Charge API enables you to receive payment creation requests and initiate payments. This documentation offers comprehensive guidance on utilizing this API effectively.
Request URL
To create a payment request, use the following API endpoint:
{base_URL}/api/query-payment
Where {base_URL} is the location of your AstimPay installation, such as https://pay.your-domain.com.
Request Headers
Include the following request headers:
Header Name | Value |
---|---|
Content-Type | "application/json" |
Accept | "application/json" |
API-KEY | Collect API KEY From Dashboard |
Request Parameters
The API expects the following parameters in the request:
Property | Presence | Type | Description |
---|---|---|---|
invoice_id | Mandatory | string | The invoice_id is received as a query parameter from the success URL provided during payment creation. |
Success Response Parameters
Property | Type | Description |
---|---|---|
full_name | string | Full Name value which was passed along with the payment request. |
string | Email value which was passed along with the payment request. | |
amount | string | Amount value which was passed along with the payment request. |
fee | string | Fee of the payment transaction. |
charged_amount | string | Amount of the payment transaction. |
invoice_id | string | AstimPay generated invoice_id for this payment creation request. |
metadata | JSON object | Any related JSON object that was passed along with the payment request. |
payment_method | string | Payment Method of the payment transaction. (bKash/Rocket/Nagad/Upay or Bank) |
sender_number | string | Sender Number of the payment transaction. |
transaction_id | string | Transaction ID of the payment transaction. |
date | string | Date of the payment transaction. |
status | string | COMPLETED or PENDING or ERROR Status of the payment |
Error Response Parameters
Property | Type | Description |
---|---|---|
status | bool | FALSE |
message | string | The message associated with the status, explains the status. |
Sample Request
<?php
$baseURL = 'https://sandbox.astimpay.com/';
$apiKEY = '4a59f023cbc02521417f21a0add4e028febb2ca8';
$fields = [
'invoice_id' => 'f993Y00ksStYwX2ElBT'
];
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $baseURL . "api/query-payment",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode($fields),
CURLOPT_HTTPHEADER => [
"API-KEY: " . $apiKEY,
"accept: application/json",
"content-type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
curl --request POST \
--url https://sandbox.astimpay.com/api/verify-payment \
--header 'API-KEY: 4a59f023cbc02521417f21a0add4e028febb2ca8' \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"invoice_id": "Erm9wzjM0FBwjSYT0QVb"
}
'
const axios = require('axios');
const options = {
method: 'POST',
url: 'https://sandbox.astimpay.com/api/verify-payment',
headers: {
accept: 'application/json',
'API-KEY': '4a59f023cbc02521417f21a0add4e028febb2ca8',
'content-type': 'application/json'
},
data: {invoice_id: 'Erm9wzjM0FBwjSYT0QVb'}
};
axios
.request(options)
.then(function (response) {
console.log(response.data);
})
.catch(function (error) {
console.error(error);
});
import requests
url = "https://sandbox.astimpay.com/api/verify-payment"
payload = {"invoice_id": "Erm9wzjM0FBwjSYT0QVb"}
headers = {
"accept": "application/json",
"API-KEY": "4a59f023cbc02521417f21a0add4e028febb2ca8",
"content-type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
Sample Response
{
"full_name": "John Doe",
"email": "[email protected]",
"amount": "100.00",
"fee": "0.00",
"charged_amount": "100.00",
"invoice_id": "f993Y00ksStYwX2ElBT",
"metadata": {
"user_id": "10",
"order_id": "50"
},
"payment_method": "bkash",
"sender_number": "01311111111",
"transaction_id": "TESTTRANS1",
"date": "2023-01-07 14:00:50",
"status": "COMPLETED"
}