Offline checkout without duplicate sales.
What a retail checkout should do when a receipt might already have been recorded.
Written by
Abdulbasit Imam
Published
The old checkout stopped when the connection dropped. Staff wrote sales on paper and entered them later. Moving the paper record into the browser helps, but it also means the device and server can disagree about whether a sale already happened.
Give each sale a stable identity
A request can reach the server even when its response never reaches the register. The register must use the same local transaction identifier on retry. In Eyiowuawi, the server uses the device and local identifiers and enforces uniqueness in the database, so repeated delivery does not create a second sale.
Save the queue outside the open tab
A prepared, authorized register can save eligible sales in IndexedDB when enabled. Keeping queued work in browser storage means a page reload does not have to erase what the cashier recorded. Reconnection is an opportunity to sync, not proof that a sale has already reached the server.
Make conflicts visible
Two registers can sell against the same stock snapshot. Duplicate prevention cannot resolve that disagreement. If the API cannot reconcile a sale safely, the queued work needs a review state so the operator can see why it did not post.