Ana içeriğe geç

Get Payment Status

Query the current status of a payment by its ID. Use this endpoint to verify payment status independently — especially useful as a fallback when a webhook notification was not received.

GET/api/payment/{paymentId}

Path Parameters

ParameterTypeDescription
paymentIdstringUUID of the payment (returned from payment, 3DS, or pre-authorization endpoints).

Response

Returns an ApiPaymentResponse object (identical to the Direct Payment response).

FieldTypeDescription
paymentIdstringUnique identifier for the payment (UUID).
orderIdstringClient's tracking number for the order.
amountnumberTransaction amount.
installmentCountnumberNumber of installments.
currencystringCurrency code.
merchantCommissionnumberCommission charged to the merchant.
statusstringPayment status (e.g., SUCCESS, FAILED, ENROLLED).
paymentDatestringDate and time (ISO format, e.g., 2023-05-01T14:30:00Z).
cardHolderNamestringName of the card holder.
panstringMasked Primary Account Number (e.g., 411111******1111).
domIntstringDomestic or International transaction (DOM/INT).
cardSchemestringCard scheme (e.g., VISA, MASTERCARD).
cardTypestringType of card (e.g., CREDIT, DEBIT).
loyaltyCodestringLoyalty program code (if applicable).
externalTransactionIdstringTransaction ID from the payment provider.
authCodestringAuthorization code from the payment provider.
resultCodestringResult code from the payment provider.
resultMessagestringResult message from the payment provider.
customerIdstringUnique identifier for the customer (if provided).

When to Use

  • 3D Secure fallback: If your success/failure callback was not triggered, poll this endpoint using the paymentId returned from POST /api/3ds.
  • Webhook fallback: If a webhook notification was not received within a reasonable time, query this endpoint to confirm the payment's final status.
  • Reconciliation: Use to verify payment status during end-of-day reconciliation.

Example

const getPaymentStatus = async (paymentId) => {
const response = await fetch(`https://api.example.com/api/payment/${paymentId}`, {
method: 'GET',
headers: {
'X-API-KEY': 'your_api_key_here',
'X-API-SECRET': 'your_api_secret_here'
}
});
return await response.json();
};

// 3DS fallback — if user was not redirected to callback
const paymentId = enrollmentResponse.paymentId; // ID from POST /api/3ds
const status = await getPaymentStatus(paymentId);

if (status.status === 'SUCCESS') {
// Payment successful
} else if (status.status === 'FAILED' || status.status === 'CANCELLED') {
// Payment failed
} else {
// Still processing (ENROLLED), wait and retry
}