Skip to content

Cancel orders

Cancel an order while no fulfillment is running, and read the 409 reason code when an order can't be canceled.

This page shows how to cancel an order, and what to do when you can’t. Your API key needs the orders:create permission.

Cancel order moves an order to the final status canceled. It also stops any fulfillment that hasn’t started yet.

Cancel an order when you have given up on it. For example:

  • a failed order after a player_id_incorrect failure, or
  • an action_required order that you won’t act on.

This keeps your records and Cardzone’s records the same.

Send a cancel request

curl -X POST https://cardzone.ai/api/b2b/v1/orders/1CBDzqwiovwVrtFk6nZ1Aw/cancel \
  -H "Authorization: Bearer $CARDZONE_API_KEY"

In the path, use the order_id or your merchant_order_ref:

  • The order_id works for any order in your store. This includes orders from the dashboard, Salla, and other Cardzone channels.
  • The merchant_order_ref only finds orders created through the API.

What you get back:

  • A successful cancel returns 200 with the order. Its status is now canceled.
  • If you send the same cancel again, you get 200 again.
  • If the order became canceled in another way (without a cancel request), you get 409 order_not_cancelable with details.reason_code set to order_already_terminal.

When an order can’t be canceled

You can cancel an order only when both of these are true:

  • Its status is processing, action_required, or failed.
  • No fulfillment attempt or provider request is running, and no shipment has left. (A provider is a supplier that delivers the item.)

Otherwise you get 409 order_not_cancelable. details.reason_code tells your code why:

{
  "error": {
    "code": "order_not_cancelable",
    "message": "This order cannot be canceled while an execution or provider request is still in progress",
    "details": { "reason_code": "fulfillment_in_progress" }
  }
}
details.reason_code Meaning What to do
order_already_terminal The order is already fulfilled, canceled, or refunded. Read its status. There is nothing to cancel.
fulfillment_in_progress A fulfillment attempt or provider request is still running. Wait for the next status change, then decide.
shipment_dispatched A physical shipment for the order has left. There is nothing to cancel. Contact support for a return.
order_not_cancelable Another rule blocked it. Read message. Contact support if you are not sure.

Cancel in the sandbox

The sandbox doesn’t save orders. So with a sandbox API key, cancel always returns 403 sandbox_order_cancellation_not_supported:

POST /orders/{id}/cancelRecorded sandbox response
POST
Response
Cardzone
Back to Cardzone

Type to search…

↑↓ navigate↵ selectEsc close