Cancel an order
Permission
orders:writeRate limit writesIdempotent with Idempotency-KeyMarks the order cancelled (payment_status becomes cancel). With restock (default true) every unit not already refunded goes back in stock. No money moves. Cancelling an order that is already cancelled changes nothing and returns it.
Store orders only: a Site product order (kind: product) answers 404.
Authorization
ESTAGE-API-KeystringheaderrequiredA project key, est_live_…, from Settings → API keys. Call from server code only.
Path parameters
idintegerrequiredBody
application/jsonrestockbooleandefault trueHeaders
Idempotency-Keystring≤ 255 charsAny unique string per attempt. A retry with the same key gets the first answer back instead of doing the work twice.
RequestcURL
curl --request POST \ --url 'https://api.estage.com/v1/orders/order-id/cancel' \ --header 'ESTAGE-API-Key: est_live_your-api-key' \ --header 'Content-Type: application/json' \ --header 'Idempotency-Key: your-unique-key' \ --data '{ "restock": true }'
OK
{
"data": {
"id": 98314,
"number": 1042,
"fulfillment_status": "unfulfilled",
"payment_status": "cancel",
"gateway": "stripe",
"cancelled_at": "2026-11-10T09:12:44Z",
"currency": "USD",
"subtotal": "54.00",
"discount_total": "5.40",
"shipping_total": "6.00",
"tax_total": "0.00",
"total": "54.60",
"refunded_total": "0.00",
"discount_code": "SUMMER10",
"customer": {
"id": 44120,
"email": "ana@example.com",
"name": "Ana Lopez"
},
"items": [
{
"id": 70211,
"product_id": 5012,
"variant_id": 30442,
"name": "Classic Tee",
"variant_title": "L",
"sku": "TEE-L",
"quantity": 2,
"unit_price": "27.00",
"total": "54.00",
"fulfilled_quantity": 0,
"refunded_quantity": 0
}
],
"created_at": "2026-11-02T14:05:31Z",
"updated_at": "2026-11-10T09:12:44Z",
"kind": "commerce",
"product": null,
"subscription_id": null,
"expires_at": null,
"access_active": null,
"shipping_address": {
"name": "Ana Lopez",
"line1": "12 Harbor St",
"line2": null,
"city": "Portland",
"state": "OR",
"postal_code": "97201",
"country": "US",
"phone": "+15035550142"
},
"billing_address": {
"name": "Ana Lopez",
"line1": "12 Harbor St",
"line2": null,
"city": "Portland",
"state": "OR",
"postal_code": "97201",
"country": "US",
"phone": "+15035550142"
},
"note": null,
"applied_discounts": [
{
"id": 412,
"method": "code",
"kind": "order",
"type": "percent",
"label": "SUMMER10",
"code": "SUMMER10",
"amount": 5.4,
"free_shipping": false
}
],
"shipping_lines": [
{
"group": "0",
"rate_id": 77,
"name": "Standard",
"method": "shipping",
"carrier_code": null,
"service_code": null,
"price": 6
}
],
"fulfillments": [],
"shipping_costs": {
"paid": 6,
"labels": 0,
"difference": 6,
"currency": "USD",
"priced": 0,
"unpriced": 0,
"foreign": []
}
}
}Example. Errors are
{ error: { code, message, details } }.