Skip to main content

POST /trending/orders/:orderId/cancel

Cancel an unpaid order. Once an order is paid or in progress it cannot be cancelled and the call answers 409 with the order's current state.

Use case​

The user abandons checkout before paying.

Headers​

HeaderRequiredDescription
AuthorizationyesBearer <accessToken>
x-user-idyesEnd-user id, 1–256 chars [A-Za-z0-9_-].

Path params​

ParamRequiredDescription
orderIdyesThe orderId of one of the user's orders. A 24-char hex id.

Response 200​

{ "order": { "orderId": "…", "providerOrderId": "…" } }

The cancelled order, same shape as in POST /trending/orders.

Errors​

StatusMeaning
400orderId is not a valid id.
401 / 403Token missing, invalid, expired or revoked / API inactive.
404Order not found — missing, or not this user's.
409The order can no longer be cancelled. Body: { "message": "…", "order": { … } } with the order's current state.
429Per-client rate limit hit.
503Trending disabled or unavailable.

Example​

curl -X POST "$BASE_URL/trending/orders/<orderId>/cancel" \
-H "Authorization: Bearer $ACCESS" \
-H "x-user-id: $USER_ID"