Preloader

Check Payment Status

Verify the outcome of a payment after the customer returns to your site. Always verify server-side — never trust client-side redirect parameters alone.

Endpoint: GET {{base_url}}/payment/success/{token}
Important: When the customer is redirected back to your return_url, a token parameter is appended. Use this token to call the status endpoint from your server to confirm payment.
Path Parameter
Parameter Type Required Description
token string Required The payment token returned from the initiate payment response, also appended to your return_url
Code Examples
<?php
require_once('vendor/autoload.php');

// Token comes from your return_url query string: ?token=xxx
$token = $_GET['token'] ?? '';

$client   = new \GuzzleHttp\Client();
$response = $client->request('GET', '{{base_url}}/payment/success/' . $token, [
    'headers' => [
        'Authorization' => 'Bearer {{access_token}}',
        'Accept'        => 'application/json',
    ],
]);

$result = json_decode($response->getBody(), true);

if ($result['type'] === 'success') {
    $trxId    = $result['data']['trx_id'];
    $payer    = $result['data']['payer'];
    $orderId  = $result['data']['custom'];  // your internal order ID
    // Mark order as paid in your database
    echo "Payment confirmed! Transaction: " . $trxId;
} else {
    echo "Payment verification failed.";
}
// Works with Node.js, Next.js (API routes), Express
const verifyPayment = async (token) => {
  const response = await fetch(`{{base_url}}/payment/success/${token}`, {
    method: 'GET',
    headers: {
      'Authorization': 'Bearer {{access_token}}',
      'Accept': 'application/json',
    },
  });

  const data = await response.json();

  if (data.type === 'success') {
    const { trx_id, payer, custom } = data.data;

    // Update your database, fulfill the order
    return { success: true, trxId: trx_id, orderId: custom };
  }

  return { success: false };
};

// Next.js API route (pages/api/payment/verify.js):
// export default async function handler(req, res) {
//   const { token } = req.query;
//   const result = await verifyPayment(token);
//   res.json(result);
// }
import requests

# Token comes from your return_url query parameter
token = request.GET.get("token")  # Django / Flask: request.args.get("token")

url = f"{{base_url}}/payment/success/{token}"

headers = {
    "Authorization": "Bearer {{access_token}}",
    "Accept": "application/json",
}

response = requests.get(url, headers=headers)
data = response.json()

if data["type"] == "success":
    trx_id   = data["data"]["trx_id"]
    payer    = data["data"]["payer"]
    order_id = data["data"]["custom"]
    print(f"Payment confirmed! TRX: {trx_id}")
    # Mark order as paid in your database
else:
    print("Payment verification failed.")
curl -X GET "{{base_url}}/payment/success/{{token}}" \
  -H "Authorization: Bearer {{access_token}}" \
  -H "Accept: application/json"
Response Examples

200 OK Payment Confirmed

{
  "message": {
    "code": 200,
    "success": ["SUCCESS"]
  },
  "data": {
    "token": "2zMRmT3KeYT2BWMAyGhq...",
    "trx_id": "BP2c7sAvw75MTlrP",
    "payer": {
      "username": "john_doe",
      "email": "john@example.com"
    },
    "custom": "ORDER-20240101-001"
  },
  "type": "success"
}

403 Forbidden Failed / Invalid

{
  "message": {
    "code": 403,
    "error": [
      "Requested with invalid token!"
    ]
  },
  "data": [],
  "type": "error"
}