Get Payment Status
GET /api/payments/{invoice_id}/status
Verify a payment server-to-server and get its real status. This endpoint also triggers fulfillment if the payment completed but has not been credited yet (both the webhook and the success redirect missed it).
Request Example
Section titled “Request Example”curl -X GET https://api.awajdigital.com/api/payments/9f8b7c6d-.../status \ -H "Authorization: Bearer your_api_token_here" \ -H "Accept: application/json"// Browser JavaScript (Fetch API)const response = await fetch('https://api.awajdigital.com/api/payments/9f8b7c6d-.../status', { method: 'GET', headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' }});
const data = await response.json();console.log(data);// Node.js with axiosconst axios = require('axios');
async function getPaymentStatus() { try { const response = await axios.get('https://api.awajdigital.com/api/payments/9f8b7c6d-.../status', { headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' } });
console.log(response.data); } catch (error) { console.error('Error:', error.response?.data || error.message); }}
getPaymentStatus();# Python with requestsimport requests
def get_payment_status(): url = 'https://api.awajdigital.com/api/payments/9f8b7c6d-.../status' headers = { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json' }
try: response = requests.get(url, headers=headers) print(response.json()) except requests.exceptions.RequestException as e: print(f'Error: {e}')
get_payment_status()<?php// PHP with cURL$url = 'https://api.awajdigital.com/api/payments/9f8b7c6d-.../status';$token = 'your_api_token_here';
$ch = curl_init($url);curl_setopt($ch, CURLOPT_HTTPGET, true);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Accept: application/json']);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
$result = json_decode($response, true);print_r($result);?>Success Response Example
Section titled “Success Response Example”{ "success": true, "invoice_id": "9f8b7c6d-...", "status": "completed", "amount": 500}| status | Meaning |
|---|---|
| completed | Payment confirmed and balance credited |
| anything else | Payment not completed (pending/failed) |
Error Responses
Section titled “Error Responses”| Status | Description |
|---|---|
| 401 | Missing or invalid access token |
| 403 | Payment API not enabled for your account |
| 404 | Payment not found or not owned by your account |
| 502 | Gateway error — payment could not be verified |
