Naafi Pay

Cancel Payment

POST/api/payment-cancel

Cancels a pending checkout session by invoice_id. Once cancelled the checkout URL stops accepting new payments and any subsequent payment attempts are rejected with a friendly message. Use this when your application knows the order is no longer valid — for example, the customer removed all items from their cart, the product went out of stock, or your fraud check failed. You cannot cancel an invoice that has already been paid; use the Refund endpoint for that.

Request headers

FieldTypeRequiredDescription
AuthorizationstringrequiredYour test or live API key.
Example: pg_live_xxx
Content-TypestringrequiredMust be application/json.
Example: application/json

Request body

FieldTypeRequiredDescription
invoice_idstringrequiredThe invoice_id of the pending checkout to cancel.
Example: inv_01HZX5JM3W7QZK8YF7N9P0RTS2

Response

200 OK
1{
2 "invoice_id": "inv_01HZX5JM3W7QZK8YF7N9P0RTS2",
3 "status": "cancelled",
4 "cancelled_at": "2026-05-30T14:20:00Z"
5}
TipCancellation triggers a webhook
Cancelling an invoice fires the payment.cancelled webhook event so any downstream system (inventory hold, CRM record) can react automatically.

Error codes

FieldTypeRequiredDescription
400already_paidoptionalThe invoice is already completed. Issue a refund instead.
400already_cancelledoptionalThe invoice is already cancelled.
401unauthorizedoptionalAPI key is missing or invalid.
404not_foundoptionalNo invoice exists for the given id.
WarningCancellation is final
A cancelled invoice cannot be reopened. If the customer changes their mind, create a fresh checkout.
Updated at: May 30, 2026