API reference

Refunds

Refund a payment and look up a refund. Card refunds are full refunds, and are reviewed before they complete.

EndpointPurpose
POST/api/v1/refunds/createRefund a payment
POST/api/v1/refunds/queryLook up a refund

Create a refund

POST/api/v1/refunds/create
FieldTypeRequiredDescription
original_order_nostringOne of these twoHansaPay's order number of the payment
original_merchant_order_nostringOne of these twoYour order number of the payment
merchant_refund_nostringYesYour refund number, at most 64 characters. See Idempotency.
refund_amountstringYesThe amount to refund, in the payment's original currency, for example "12.50"
reasonstringNoAt most 255 characters
notify_urlstringNoWhere to send refund.updated webhooks. If you leave it out, you receive no refund webhooks.
metadatastringNoReturned in the refund webhook
{
  "original_merchant_order_no": "ORDER-1001-069I",
  "merchant_refund_no": "REFUND-1001-069I",
  "refund_amount": "25.00",
  "reason": "Customer cancelled the subscription",
  "notify_url": "https://merchant.example.com/hansapay/webhook",
  "metadata": "ticket-5521"
}
200 · response
{
  "code": 0,
  "msg": "success",
  "data": {
    "refund_no": "362191056193720320",
    "merchant_refund_no": "REFUND-1001-069I",
    "original_order_no": "362191050694987776",
    "original_merchant_order_no": "ORDER-1001-069I",
    "status": "PENDING",
    "refund_amount": {
      "currency": "USD",
      "value": "25.00"
    },
    "created_at": "2026-09-26T18:57:56+08:00"
  }
}

Response fields: refund_no, merchant_refund_no, original_order_no, original_merchant_order_no, status, refund_amount and created_at.

Rules:

  • The payment must be paid (SUCCESS, or already partly refunded) and must not have a chargeback.
  • The total of your refunds on a payment cannot exceed the payment amount.
  • Your available balance must cover the refund plus the refund fee. The amount is held from your balance while the refund is pending, and released if it fails.
  • On card, Apple Pay and Google Pay payments, only one full refund is possible (see What to expect).

A refund that is refused when you create it returns an error. The refund number is used up even so: HansaPay records the refused refund with status FAILED, and you can look it up by merchant_refund_no.

Query a refund

POST/api/v1/refunds/query

POST/api/v1/refunds/query with exactly one of refund_no or merchant_refund_no.

{
  "merchant_refund_no": "REFUND-1001-069I"
}
200 · response
{
  "code": 0,
  "msg": "success",
  "data": {
    "refund_no": "362191056193720320",
    "merchant_refund_no": "REFUND-1001-069I",
    "original_order_no": "362191050694987776",
    "original_merchant_order_no": "ORDER-1001-069I",
    "status": "SUCCESS",
    "refund_amount": {
      "currency": "USD",
      "value": "25.00"
    },
    "reason": "Customer cancelled the subscription",
    "created_at": "2026-09-26T18:57:56+08:00",
    "updated_at": "2026-09-26T18:57:56+08:00"
  }
}

Response fields: refund_no, merchant_refund_no, original_order_no, original_merchant_order_no, status, refund_amount, reason, created_at and updated_at.

Refund statuses

StatusMeaning
PENDINGSubmitted and waiting for review or for the provider
SUCCESSThe money has been returned to the payer
FAILEDThe refund did not happen; any held amount has been released

HansaPay checks pending refunds with the provider every few minutes, so you do not need to poll. A refund can become FAILED when:

  • the review rejects it;
  • the provider reports it as failed or closed;
  • the provider has no record of it 30 minutes after it was submitted.