Retrieve Payment
Check the status of a payment transaction
Check the current status of a payment transaction.
Endpoint
GET /payment/retrieve/:transactionId
Request headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Path parameters
| Parameter | Type | Description |
|---|---|---|
transactionId | string | The transaction ID returned when you created the payment |
Response
{
"success": true,
"data": {
"transactionId": "txn_abc123def456",
"amount": 500,
"description": "Order #67890",
"status": "Completed",
"paymentMethod": "bKash",
"createdAt": "2024-01-15T10:30:00.000Z",
"updatedAt": "2024-01-15T10:35:00.000Z"
}
}
Status values
| Status | Description |
|---|---|
Processing | Payment is being processed. The customer may still be completing the transaction. |
Completed | Payment was successful. The funds have been received. |
Cancelled | Payment was cancelled or failed. |
Example
const axios = require("axios");
const transactionId = "txn_abc123def456";
const response = await axios.get(
`https://sandbox.payzava.com/cp/api/v1/payment/retrieve/${transactionId}`,
{
headers: {
"x-api-key": "sk_sandbox_your_api_key",
},
}
);
const { status, amount, transactionId: txnId } = response.data.data;
console.log(`Transaction ${txnId}: ${status} (${amount} BDT)`);
if (status === "Completed") {
// Fulfill the order
console.log("Payment successful!");
} else if (status === "Cancelled") {
// Payment failed or was cancelled
console.log("Payment was cancelled.");
} else {
// Still processing
console.log("Payment is still processing.");
}
When to call retrieve
- After redirect — When the customer returns to your
redirect_url, call retrieve to verify the actual payment status. - After callback — When you receive a callback at your
callback_url, call retrieve to confirm the status before taking action. - On-demand — To check the current status of any transaction at any time.
Note:
Always use the retrieve endpoint to verify payment status. Never rely solely on redirect parameters or callback data, as they could be tampered with.