Api reference
Get Transaction Status
Verify the status of a specific transaction
Get Transaction Status
Check the current status of a transaction using its transaction ID. This endpoint helps you track payment processing and determine if a transaction was successful, failed, or is still pending.
Endpoint
POST https://api.bridgeagw.com/get_transaction_statusRequest Headers
Authorization: Basic <base64_encoded_credentials>
Content-Type: application/jsonRequest Body
{
"service_id": 1,
"transaction_id": "70"
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
service_id | integer | Yes | Your service identifier |
transaction_id | string | Yes | The transaction ID to check |
Response
Success Response (200)
{
"response_data": {
"network_transaction_id": "57537797464",
"status_desc": "Transaction Successful",
"transaction_id": "37",
"status": "000",
"message": "SUCCESSFUL"
},
"response_message": "Success",
"response_code": "000"
}Response Fields
| Field | Type | Description |
|---|---|---|
network_transaction_id | string | The network's transaction ID |
status_desc | string | Human-readable status description |
transaction_id | string | Your original transaction ID |
status | string | Status code (000 = Success, 001 = Failed) |
message | string | Status message |
Failed Transaction Response
{
"response_data": {
"network_transaction_id": "61962982397",
"status_desc": "Transaction Failed",
"transaction_id": "73",
"status": "001",
"message": "FAILED"
},
"response_message": "Success",
"response_code": "000"
}Status Codes
| Status Code | Description |
|---|---|
000 | Transaction Successful |
001 | Transaction Failed |
002 | Transaction Pending |
003 | Transaction Cancelled |
Example Usage
cURL
curl -X POST "https://api.bridgeagw.com/get_transaction_status" \
-H "Authorization: Basic <your_credentials>" \
-H "Content-Type: application/json" \
-d '{
"service_id": 1,
"transaction_id": "70"
}'JavaScript
const response = await fetch('https://api.bridgeagw.com/get_transaction_status', {
method: 'POST',
headers: {
'Authorization': 'Basic <your_credentials>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
service_id: 1,
transaction_id: "70"
})
});
const result = await response.json();
console.log(result);Python
import requests
url = "https://api.bridgeagw.com/get_transaction_status"
headers = {
"Authorization": "Basic <your_credentials>",
"Content-Type": "application/json"
}
data = {
"service_id": 1,
"transaction_id": "70"
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)Use Cases
Payment Verification
After initiating a payment, use this endpoint to verify if the transaction was successful:
// Check payment status after 30 seconds
setTimeout(async () => {
const status = await checkTransactionStatus(transactionId);
if (status.status === '000') {
console.log('Payment successful!');
} else {
console.log('Payment failed:', status.status_desc);
}
}, 30000);Transaction History
Query multiple transactions to build a transaction history:
const transactionIds = ['70', '71', '72', '73'];
const statuses = await Promise.all(
transactionIds.map(id => checkTransactionStatus(id))
);Webhook Verification
Verify transaction statuses received via webhooks:
app.post('/webhook', async (req, res) => {
const { transaction_id } = req.body;
// Verify the status with the API
const status = await checkTransactionStatus(transaction_id);
if (status.status === '000') {
// Process successful payment
await processSuccessfulPayment(transaction_id);
}
res.status(200).send('OK');
});Error Handling
If the transaction ID doesn't exist or there's an error, you'll receive an appropriate error response:
{
"response_message": "Transaction not found",
"response_code": "404"
}Notes
- Transaction statuses are updated in real-time
- You can check the status of any transaction you've initiated
- The
network_transaction_idcan be used for reference with the mobile money provider - Status checks don't affect the transaction in any way
- Failed transactions may have additional error details in the
status_descfield