Refunds
Full and partial refunds, why a webhook must come first, and how partial refunds stack.
Create a refund
curl -X POST https://api.checkoutos.in/payments/chk_a1b2c3d4e5f6a7b8/refund \
-H 'Content-Type: application/json' \
-d '{"amount": 25000, "reason": "Customer cancelled one item"}'Both fields are optional:
Prop
Type
{
"success": true,
"data": {
"refundId": "ref_9f8e7d6c5b4a3210",
"paymentId": "chk_a1b2c3d4e5f6a7b8",
"status": "PENDING",
"amount": 25000,
"currency": "INR",
"gateway": "razorpay",
"createdAt": "2026-10-18T10:04:11.000Z"
}
}A webhook must come first
Refunds require a non-empty gatewayPaymentId
gatewayPaymentId is backfilled only when a payment webhook arrives. Until then it is an
empty string, and a refund attempt returns REFUND_NOT_ALLOWED (422).
This is not an arbitrary ordering constraint — the gateway's refund API is keyed on the payment ID, which the gateway only tells you about when it reports the capture.
Partial refunds stack
A PARTIALLY_REFUNDED payment can receive further refunds, up to the original amount.
₹1,000 payment → SUCCESS
refund ₹250 → PARTIALLY_REFUNDED (₹750 refundable)
refund ₹250 → PARTIALLY_REFUNDED (₹500 refundable)
refund ₹500 → REFUNDED (terminal)Exceeding the original amount returns REFUND_AMOUNT_EXCEEDS_PAYMENT (422).
Checking status
curl -s https://api.checkoutos.in/refunds/ref_9f8e7d6c5b4a3210 | jq| Status | Meaning |
|---|---|
PENDING | Accepted, not yet submitted upstream |
PROCESSING | The gateway is processing it |
SUCCESS | Refunded |
FAILED | Terminal failure |
Paytm cannot poll refund status
getRefundStatus() on the Paytm plugin throws GatewayUnavailableError unconditionally —
Paytm does not support it. A Paytm refund's terminal state arrives by webhook or not at all,
so do not build a reconciliation job around polling there.
Errors
| Code | Status | Cause |
|---|---|---|
PAYMENT_NOT_FOUND | 404 | No payment for that chk_ ID |
REFUND_NOT_FOUND | 404 | No refund for that ref_ ID |
REFUND_NOT_ALLOWED | 422 | The payment is not in a refundable state |
REFUND_AMOUNT_EXCEEDS_PAYMENT | 422 | Would exceed the original amount |
REFUND_FAILED | 502 | The gateway returned an unexpected response |