Order Cancel
Type: Mutation
Overview
The orderCancel mutation cancels (archives) a pending, unpaid order. Use it from ecommerce integrations when the customer abandons checkout or switches to another payment method, so the Sevi order does not stay open until the automatic abandon-timeout sweep archives it.
Rules
- Only the order's own vendor (the wallet behind your API token) can cancel an order.
- Only orders with status
PENDINGand payment statusPENDINGcan be cancelled. Paid or shipped orders are rejected. - Cancelling an already archived order is a no-op and returns the order unchanged.
- Any in-flight payment intent for the order is cancelled as well (best effort).
Request
mutation OrderCancel($orderId: String!) {
orderCancel(orderId: $orderId) {
order {
id
referenceNumber
status
paymentStatus
}
}
}
Response
{
"data": {
"orderCancel": {
"order": {
"id": "01234567-abcd-...",
"referenceNumber": "D123456",
"status": "ARCHIVED",
"paymentStatus": "PENDING"
}
}
}
}
Errors
| Message | Cause |
|---|---|
Order with id ... not found | Unknown order id |
Unauthorized | The order belongs to a different vendor |
Only pending, unpaid orders can be cancelled. | Order already paid, shipped or delivered |
Order advanced while cancelling; not cancelled. | A payment confirmation raced the cancellation |