AbsolutePayDocs

Refunds

Return a settled payment, fully or partially, and track it to completion.

Refund a settled order back to the payer. Crypto has no chargeback mechanism — a refund is a new outbound transaction you initiate, paid from your workspace balance back to the payer. You create it, it processes on-chain, then a charge.refunded webhook fires. The accrued fees on the original payment are reversed.

Before you start: refunds need the payments:write scope (Authentication), and the original order must have reached PAID (see Confirm the payment).

Only settled orders can be refunded

You can refund an order that reached PAID. The refund amount can be the full amount or less (partial) — over-refunding beyond the collected total is rejected with a 422. Refunds are keyed to the original merchantTradeNo.

Create a refund

const refund = await ap.refunds.create({
  merchantTradeNo: "order-1024",                 // the settled order to refund
  amount: { amount: "49.99", currency: "USDT" }, // ≤ the original amount (partial allowed)
  reason: "customer request",
});
console.log(refund.refundRequestId, refund.status); // e.g. "rf_…", "PENDING"
refund = ap.refunds.create(
    merchant_trade_no="order-1024",                 # the settled order to refund
    amount={"amount": "49.99", "currency": "USDT"}, # ≤ the original amount (partial allowed)
    reason="customer request",
)
print(refund["refundRequestId"], refund["status"])  # e.g. "rf_…", "PENDING"
refund, err := ap.Refunds.Create(ctx, absolutepay.RefundParams{
	MerchantTradeNo: "order-1024",                                          // the settled order to refund
	Amount:          absolutepay.Money{Amount: "49.99", Currency: "USDT"}, // ≤ the original amount (partial allowed)
	Reason:          "customer request",
})
if err != nil {
	log.Fatal(err)
}
fmt.Println(refund["refundRequestId"], refund["status"]) // e.g. "rf_…", "PENDING"
BODY='{"merchantTradeNo":"order-1024","amount":{"amount":"49.99","currency":"USDT"},"reason":"customer request"}'
curl https://api.absolutepay.io/v1/refunds \
  -H "Authorization: Bearer $APP_TOKEN" -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  $(sign POST /v1/refunds "$BODY") -d "$BODY"

Where the money goes

A refund always goes back to whoever paid: to their exchange account if they paid from one, or to the address the payment came from (on networks without memos). You don't choose the destination. The one exception is a payment from an external wallet whose sending address isn't known, or a payment on a memo network such as TON or XRP. For that case, pass refundAddress with the customer's receiving address; this needs the payouts:write scope as well. chain defaults to the network the order was paid on, and memo is for networks that need one:

{
  "merchantTradeNo": "order-1024",
  "amount": { "amount": "49.99", "currency": "USDT" },
  "refundAddress": { "address": "TXYZopYRdj2D9XRtbG411XZZ3kM5VkAeBf", "chain": "TRX" }
}

chain must be a network refunds of that currency go out on — list them with GET /v1/refunds/chains?currency=USDT (each with a label, memoRequired and the network fee). Any other network is refused with 400 refund_chain_unsupported before anything is sent.

Without it, such a refund is refused with 409 refund_address_required. Sending refundAddress for any other payment is refused with a 400. Refunds of one order can't add up to more than was paid (422 refund_exceeds_paid). A refund sent on-chain must be at least the network's minimum, the same as for payouts (minWithdraw in GET /v1/payouts/options); a smaller one is refused with 400 amount_below_minimum before anything is sent. As with payouts, a burst of refunds in a short window freezes the account (429 velocity_frozen).

Track it

const status = await ap.refunds.get(refund.refundRequestId);
status = ap.refunds.get(refund["refundRequestId"])
status, err := ap.Refunds.Get(ctx, refund["refundRequestId"].(string))
if err != nil {
	log.Fatal(err)
}
fmt.Println(status)
curl "https://api.absolutepay.io/v1/refunds/rf_…" \
  -H "Authorization: Bearer $APP_TOKEN" $(sign GET /v1/refunds/rf_… "")

A refund starts PENDING and reaches REFUND_SUCCESS (or REFUND_REJECTED) when it settles — at which point the charge.refunded webhook fires, or charge.refund_failed (data.status: REFUND_FAILED) for a rejected one. A rejected refund sent nothing to the customer, and the amount can be refunded again. Treat these webhooks as the source of truth and act idempotently on the refund id (data.refundId). Full fields are on POST /v1/refunds in the API reference.

Gotchas

  • A settled refund is final. It's an on-chain transfer — once REFUND_SUCCESS, it cannot be reversed or recalled. Double-check the amount before creating one.
  • Retries: POST /v1/refunds is a money-moving call — it accepts an Idempotency-Key header (shown in the curl tab); reuse the same key when retrying so the refund is applied at most once. After an ambiguous failure (timeout), check the refund's state before creating it again.
  • Amounts are decimal strings ("49.99"), positive, ≤ 6 fraction digits, in the original payment's currency. Partial refunds are allowed up to the collected total across all refunds on the order.
  • In the sandbox, refunds are mock-backed — no real on-chain transfer happens, and the same charge.refunded webhook fires on completion, so you can test your handler end to end.

Next

On this page