Transaction Status API is used to get transaction details and current transaction Status. Use the below parameters with Header to fetch Transaction Status.
You need to pass Secret-Key to authenticate request. You can find Secret-key for each profile in Settings menu.
HeadersField | Description |
---|---|
Content-Type | application/json |
Accept | application/json |
Authorization |
Bearer YOUR-SECRET-KEY
You have to pass your secret key inside the Authorization header.. |
One of the below parameters are required.
After the transaction completes, merchant need to verify transaction. In case pending transaction, merchant can call Status API to check if pending transaction completed.
Field | Description |
---|---|
order_id | Merchant transaction unique id. Example :- 5625235FGFS |
transaction_id | PayAgency transaction unique id. Example :- T171705485690INKBW |
These are the possible response you will receive in the status API. You will need to handle transaction according to the response you receive.
status | Description |
---|---|
200 | Status API executed successfully. |
401 | Authentication failed. Wrong or no secret key passsed in the header. |
402 | Validation failed. Wrong or no required parameters passed in the payment API. |
404 | Transaction not found for the current Profile. |
When you receive status parameter value 200, you will get transaction.result.status parameter with below possible values. You will need to handle transaction according to the response you receive.
transaction.result.status | Description |
---|---|
success | Transaction processed successfully and no other action required. |
redirected | Transaction required 3DS authentication. You will need to redirect user auth_url parameter received in the response.
|
pending | Transaction in pending status. Wait for few minutes to receive final webhooks from our server or call Status API later. |
to_be_confirm | Transaction is processed but yet to be confirmed from the bank side. Generally confirms in minutes after transaction processed. Wait for a minute to receive final webhooks from our server or call Status API later. |
failed | Transaction is declined by the connector. transaction.result.message included the message from the bank. No other action required. |
canceled | Transaction is canceled by the client. |
abandoned | Transaction is abandoned by the client in the middle of transaction process. |
blocked | Transaction is blocked. PayAgency system blocked the transaction due to some limits or restriction set by the merchant in connector configuration. |
curl --location 'https://api.pay.agency/v1/live/get/transaction' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR-SECRET-KEY' \
--data-raw '{
"order_id":"642632732"
}'
<?php
$data = [
'transaction_id' => 'T211703151107HOKWN',
];
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.pay.agency/v1/live/get/transaction',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS => json_encode($data),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer YOUR-SECRET-KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
var myHeaders = new Headers();
myHeaders.append("Content-Type", "application/json");
myHeaders.append("Authorization", "Bearer YOUR-SECRET-KEY");
var raw = JSON.stringify({
"order_id": "642632732"
});
var requestOptions = {
method: 'POST',
headers: myHeaders,
body: raw,
redirect: 'follow'
};
fetch("https://api.pay.agency/v1/live/get/transaction", requestOptions)
.then(response => response.text())
.then(result => console.log(result))
.catch(error => console.log('error', error));
var axios = require('axios');
var data = JSON.stringify({
"order_id": "642632732"
});
var config = {
method: 'post',
maxBodyLength: Infinity,
url: 'https://api.pay.agency/v1/live/get/transaction',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR-SECRET-KEY'
},
data : data
};
axios(config)
.then(function (response) {
console.log(JSON.stringify(response.data));
})
.catch(function (error) {
console.log(error);
});
OkHttpClient client = new OkHttpClient().newBuilder()
.build();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"order_id\":\"642632732\"}");
Request request = new Request.Builder()
.url("https://api.pay.agency/v1/live/transaction")
.method("POST", body)
.addHeader("Content-Type", "application/json")
.addHeader("Authorization", "Bearer YOUR-SECRET-KEY")
.build();
Response response = client.newCall(request).execute();
import http.client
import json
conn = http.client.HTTPSConnection("localhost", 8000)
payload = json.dumps({
"order_id": "642632732"
})
headers = {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR-SECRET-KEY'
}
conn.request("POST", "/v1/live/get/transaction", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
{
"status": 200,
"message": "status",
"transaction": {
"order_id": "test",
"transaction_id": "T111704977232NNTX6",
"terminal_id": null,
"customer": {
"first_name": "test",
"last_name": "test",
"email": "test@gmail.com",
"phone_number": "789611212"
},
"billing": {
"zip": "test",
"address": "test",
"city": "test",
"state": "test",
"country": "US"
},
"payment_details": {
"card_number": "426398XXXXXX9299",
"card_expiry_month": "11",
"card_expiry_year": "2024",
"card_cvv": "XXX"
},
"order": {
"amount": "15.00",
"currency": "USD"
},
"device": {
"ip_address": "192.12.12.7"
},
"result": {
"status": "canceled",
"message": "Transaction canceled by user."
},
"refund": {
"status": false,
"refunded_on": null
},
"chargebacks": {
"status": false,
"chargebacked_on": null
}
}
}
{
"status": 401,
"message": "Invalid Secret key."
}
{
"status": 402,
"message": "Error, please check errors paramter.",
"errors": {
"order_id": [
"The order id field is required when transaction id is not present."
],
"transaction_id": [
"The transaction id field is required when order id is not present."
]
}
}
{
"status": 404,
"message": "not found"
}