Create Refund
Initiate a refund request via the Payzava API
Initiate a refund for a completed payment.
Endpoint
POST /refund/create-a-request
Request headers
| Header | Required | Description |
|---|---|---|
x-api-key | Yes | Your API key |
Content-Type | Yes | application/json |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
transactionId | string | Yes | The original payment transaction ID to refund |
amount | number | Yes | Amount to refund in BDT (can be partial) |
accountType | string | Yes | Type of account: PERSONAL_ACCOUNT or BUSINESS_ACCOUNT |
accountNumber | string | Yes | The account number to receive the refund |
note | string | No | Reason for the refund |
Account types
| Value | Description |
|---|---|
PERSONAL_ACCOUNT | Refund to a personal MFS account |
BUSINESS_ACCOUNT | Refund to a business MFS account |
Response
{
"success": true,
"data": {
"refundRequestId": "refund_abc123",
"transactionId": "txn_abc123def456",
"amount": 500,
"status": "Processing",
"createdAt": "2024-01-15T10:30:00.000Z"
}
}
Example
const axios = require("axios");
const response = await axios.post(
"https://sandbox.payzava.com/cp/api/v1/refund/create-a-request",
{
transactionId: "txn_abc123def456",
amount: 250,
accountType: "PERSONAL_ACCOUNT",
accountNumber: "01712345678",
note: "Customer requested partial refund",
},
{
headers: {
"Content-Type": "application/json",
"x-api-key": "sk_sandbox_your_api_key",
},
}
);
const { refundRequestId, status } = response.data.data;
console.log(`Refund ${refundRequestId}: ${status}`);
After creating a refund
- The refund status starts as
Processing. - You will receive a callback at your configured callback URL when the status changes.
- Use the retrieve endpoint to check status.
- You can cancel the refund while it is still
Processing.