What it does
Move an order to a new state — accept it into processing, mark it completed, or cancel it. Enforced by the platform's state machine, so only transitions valid for a vendor actor are accepted. Vendor-allowed moves: created → cancelled, paid → processing, paid → cancelled, processing → completed, processing → cancelled. Not vendor-driven: created → paid (the payments service fires it on successful capture), and any transition to refunded (admin-only). Terminal states (completed, cancelled, refunded) accept no further outgoing transitions.
Auto-refund on vendor cancel. A vendor cancel from paid or processing also triggers a full automatic refund of order.total_amount, routed back to the original payment method (card → card gateway, wallet → wallet, tamara → tamara, split-paid → proportional). The response returns as soon as the state flip commits; the gateway leg settles asynchronously. Two webhooks fire on cancel-from-paid: order.cancelled (immediate) + order.refunded (when the gateway confirms settlement — usually seconds for wallet/Tamara, up to a few days for card). Cancel from created has no captured payment: only order.cancelled fires, no refund. Partial refunds on cancel are not supported — full only.
Path
order_uuid returned by create-order or received on a webhook.paid, processing, completed, cancelled, refunded. Vendors cannot pick paid or refunded — those are gated to the payments service and admin respectively.cancelled.{ "internal_note": "kitchen accepted" }).Request schema
{
"to_state": <string, enum>, // required — "paid" | "processing" | "completed" | "cancelled" | "refunded"
// vendor-driven set: "processing" | "completed" | "cancelled"
"reason": <string, ≤1000> | null, // optional — audit note
"metadata": <object> | null // optional — free-form JSON stored on the transition row
}Response
true on 200, false on every error envelope.to_state you sent. Both keys are returned for backwards compat; treat them as aliases.order.processing, order.completed, order.cancelled), so you can diff against your side.TARGET_STATE_REQUIRED (400), ORDER_NOT_FOUND (404), INVALID_TRANSITION / TERMINAL_STATE / ORDER_UPDATED_ELSEWHERE (409). Do not parse the human message.Response schema
// 200 OK — transition applied
{
"status": true,
"data": {
"order_uuid": "0193b09d-9c8a-7af3-8b56-a51d6a3e4f10",
"status": "processing", // the new state
"state": "processing", // alias of status (backwards-compat)
"updated_at": "2026-09-21T14:22:11.000Z"
},
"message": "OK"
}
// 400 Bad Request — required field missing or malformed
{
"status": false,
"error_code": "TARGET_STATE_REQUIRED",
"message": "to_state is required"
}
// 404 Not Found — no such order for this mini-app
{
"status": false,
"error_code": "ORDER_NOT_FOUND",
"message": "Order 0193b09d-… not found"
}
// 409 Conflict — state machine rejected the transition.
// error_code narrows the failure:
// INVALID_TRANSITION — not allowed from the current state for a vendor
// TERMINAL_STATE — the order is already in a terminal state
// ORDER_UPDATED_ELSEWHERE — optimistic-lock lost, refetch and retry
{
"status": false,
"error_code": "INVALID_TRANSITION",
"message": "no transition from \"created\" to \"completed\""
}