Order and payment states
The seven statuses of an order and what moves it between them, the states of the card reader, the statuses of a payment and the sync states.
On this page
An order has one status. A change the current status does not allow is refused with an error code and changes nothing.
Order states
| Status | Meaning |
|---|---|
open | Lines, discounts and the customer can change. |
on_hold | The order waits with its lines. Nothing changes until it is resumed or voided. |
awaiting_payment | A payment has started and nothing is settled. A declined card leaves the order here. |
partially_paid | Approved payments settle part of the total; due is above zero. |
paid | The approved payments cover the total. Lines and payments no longer change; the order can be refunded. |
refunded | Every unit was returned. |
voided | The order ended before any payment was approved. |
What moves an order
| Operation or event | From | To | Refused when |
|---|---|---|---|
addLine, updateLine, removeLine, updateOrder | open | open | The order is not open (invalid_status). |
holdOrder | open | on_hold | The order is not open (invalid_status) or has no lines (empty_order). |
resumeOrder | on_hold | open | The order is not held (invalid_status) or the current order of the till has lines (sale_in_progress). |
startCardPayment | open | awaiting_payment | No lines (empty_order); a status other than open, awaiting_payment and partially_paid (invalid_status); the reader is working (reader_busy); the till is offline (network_lost); the units are not on the shelf (out_of_stock); an amount of zero (invalid_amount) or above the due (amount_exceeds_due). |
| The reader approves the card | awaiting_payment, partially_paid | paid when the payments cover the total, else partially_paid | Not a call: it is the answer of the reader. |
| The reader declines the card | awaiting_payment, partially_paid | The same status; a declined payment is added | Not a call: it is the answer of the reader. |
retryCardPayment | awaiting_payment | awaiting_payment | The reader has no declined card (no_declined_card); the till is offline (network_lost). |
cancelCardPayment | awaiting_payment | open, or partially_paid when a payment is approved | The reader is reading or authorising (reader_busy); it is not waiting and has no declined card (no_card_payment). |
takeCashPayment | open, awaiting_payment, partially_paid | paid or partially_paid | No lines (empty_order); a status other than open, awaiting_payment and partially_paid (invalid_status); the reader is working (reader_busy); the units are not on the shelf (out_of_stock); an amount of zero (invalid_amount). |
voidOrder | open, on_hold, awaiting_payment | voided | The order is paid or refunded (order_paid), partially_paid (payments_taken) or already voided (invalid_status); it has no lines (empty_order); the reader is reading or authorising for it (reader_busy). |
createRefund | paid | paid while units are left, refunded when every unit is returned | The order is not paid (not_paid) or is fully returned (nothing_to_refund); the till is offline (network_lost); the sale is still queued (order_not_posted); the lines, the method or the amount do not fit (quantity_exceeds_sold, method_not_used, exceeds_method, insufficient_cash, reason_required). |
Every change is also refused with day_closed while the business day is closed, and with revision_conflict when expectedRevision is not the current revision. takeCashPayment on an open order passes through awaiting_payment, so it adds two to the revision. A cash payment needs no network.
Card reader states
| Status | Meaning |
|---|---|
idle | The reader is free. |
waiting | The reader has the amount and waits for the card. |
reading | The card is being read. |
authorising | The card network is answering. |
approved | The card was approved and the payment is on the order. |
declined | The card was declined. The reason is on the declined payment. |
cancelled | The amount was taken back from the reader. |
startCardPaymentmoves a reader that isidle,approved,declinedorcancelledtowaiting. While it iswaiting,readingorauthorising, a new payment is refused withreader_busy.- The reader moves from
waitingtoreadingand toauthorisingas the customer presents the card, and endsapprovedordeclined. These steps are not calls of the API: read them onreader.stateof the till. retryCardPaymentmovesdeclinedback towaiting;cancelCardPaymentmoveswaitingordeclinedtocancelled. A reader that is reading or authorising cannot be cancelled.- When the sale is paid, the reader goes back to
idle. If the network is lost while the reader waits for the card, the amount is taken back and the reader iscancelled.
Payment statuses
| Status | Meaning |
|---|---|
The payment settles its amount. | |
| The payment settles nothing. It stays on the order with the amount it asked for. |
Sync states
| Status | Meaning |
|---|---|
| The order is not paid, or it was voided. | |
queued | The sale is paid and the till stores it, because it had no network or earlier sales were still waiting. It waits in the queue, first in, first out. |
posted | Stock, the books and reporting have the sale. Posting a queued sale adds one to the revision. |