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

HeaderRequiredDescription
x-api-keyYesYour API key
Content-TypeYesapplication/json

Request body

FieldTypeRequiredDescription
transactionIdstringYesThe original payment transaction ID to refund
amountnumberYesAmount to refund in BDT (can be partial)
accountTypestringYesType of account: PERSONAL_ACCOUNT or BUSINESS_ACCOUNT
accountNumberstringYesThe account number to receive the refund
notestringNoReason for the refund

Account types

ValueDescription
PERSONAL_ACCOUNTRefund to a personal MFS account
BUSINESS_ACCOUNTRefund 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.