Offline counter

Tills that keep selling with cash and card while Stater or the network is down, and send each sale once Stater answers again.

See it in the tour: Keep selling offline

On this page

An offline till keeps selling with cash and card while Stater, or the network, is down. Each sale is kept on the till under its own receipt number, such as K7Q2-0042, and sends itself when Stater answers again. Stater records it once, at the time it happened, on that day's business date.

Offline tills are part of the Growth plan and up. A lapsed licence stops new tills and new offline passes, but tills already set up always send the sales they hold: money already taken is always recorded.

For staff at the counter#

  • When Stater stops answering, the counter says so in a dark strip and the shell bar reads Offline. Keep selling.
  • Scan, search, tabs, folders and tiles work as before, from the till's copy of the catalogue. Tiles show no stock figures offline.
  • Take cash or card only. The card terminal is not connected: key the amount in, and type the approval code from the slip. Split is card and cash.
  • Vouchers, points, account charges, bank transfers, returns and refunds, customer search, cash movements and cash-ups need Stater. So do discounts over 10% (they need a manager's PIN). Take 10% or less, or wait.
  • Add customer takes the number on their loyalty card or their reference (C-1042). Stater checks it and adds their points when the sale sends.
  • After payment the counter shows the receipt number, such as K7Q2-0042. Print receipt prints it. Once the sale has sent, it also has an SO- reference, and the receipt number finds it in Sell › Orders.
  • Sales on this till lists what is waiting, what was sent and anything Stater refused, with the reason. Send now tries straight away.
  • The counter sells as whoever last signed in on the till while Stater was reachable. There is no sign-in while offline. Signing out stops offline selling until someone signs in again online.
  • Online, the counter on a till always sells on the till's own register, so its cash, online and offline, is counted in one drawer.
  • A sale that was on the online counter when Stater stopped answering moves to the offline counter, which asks staff to check whether its payment went through before taking payment again.
  • Offline selling stops at the time shown in the strip: when the offline pass runs out (72 hours after the last sign-in, unless a manager chose another window) or when the till's copy of the catalogue is that old. Connect the till to Stater to carry on.
  • Never clear this browser's data on a till. It holds the sales waiting to send.

For managers: setting a till up#

  1. On the till, open Stater in its browser and sign in as a manager (or the owner).
  2. Go to Sell › Offline tills and press Set up this browser. Name the till, pick its store and register, and how long it may sell offline: 24 or 48 hours, 72 hours (the default) or 7 days.
  3. The till copies the catalogue (products, prices, tax rates, promotions, categories, the counter layout and its pictures, and the receipt details). Staff who then sign in on it get an offline pass for that window. The copy and passes refresh every 10 minutes while the till is online.
  4. On a tablet, choose Install or Add to home screen to open it like an app ("Stater Counter"). Stater asks the browser to keep the till's data even when space is short.

Sell › Offline tills shows each till: waiting sales (as last reported), when it was last seen and last sent, and refusals in the last 30 days. What it sent is the sync log: every sale with its SO- reference, notes, and the reason for each refusal with what was sold and how it was paid (what the till sent is kept only while small, and not past 500 refusals from one till in a day). Today also shows a till holding sales it has not sent for over half an hour.

Remove stops a till selling offline at once. Choose:

  • Keep its waiting sales when the till is in your hands: sales made before now still send, then it clears its offline data.
  • Refuse them when it is lost or stolen: everything it has not sent is refused, and it clears its data the next time it reaches Stater.

Setting up, changing and removing tills needs the Set up and remove offline tills permission (sell.devices), which owners and store managers have.

What Stater checks when sales arrive#

Stater keeps the till's prices: the money was taken at them. These are recorded but flagged, in the sync log, the order's timeline and the audit log, for a manager to review:

  • a price that differs from the product's price now ("Sold at $4.50; the price is now $5.00");
  • a discount over 10% without a manager;
  • stock going below zero ("Stock of Flat white at Main Street is now -2. Count it.");
  • cash that arrives after the register was counted (also noted on the cash-up: count again, or note the difference);
  • a customer code nobody has, or a product that is no longer in Stater.

These are refused, never recorded:

  • a payment other than cash or card;
  • sums that do not add up, or a tax rate outside 0 to 50%;
  • a sale outside the seller's offline pass on that till, dated in the future, before the till was set up, or after it was removed;
  • a receipt number already used for a different sale.

Sending the same sale again is answered with the sale already recorded: nothing is recorded twice. Cost of sale uses the product's cost when the sale arrives.

How it works#

  • Device credential. Setting a till up gives its browser a random credential in an HttpOnly cookie (stater_device, SameSite=Strict, sent only to /api/v1/till/…). Scripts on the page cannot read it, and Stater keeps only its SHA-256. Removing the till makes it useless at once.
  • Offline pass. Each check-in from a signed-in person records a pass on the server (who, first and last sign-in, expiry). Sales are accepted only when they fall inside a pass for that person on that till. A pass that ran out is kept, and the next sign-in starts a new one, so sales made under the old pass still record while the gap between them is never covered. Passes end at once when the person is deactivated, a manager resets their password, or their role or stores change: sales dated before that still record, later ones are refused. The till keeps names and expiry times only: no passwords, PINs, session tokens, customers, costs or stock figures.
  • Service worker. Only on tills, a service worker keeps the app shell (the page, its scripts, styles and icons) so the till opens with Stater down. It never handles /api, /health or /metrics, so no API answer is ever cached in the browser.
  • Local data. IndexedDB (stater-counter) holds the catalogue copy, tile pictures, passes and the queue. Receipt numbers come from a counter kept in the same transaction as the sale, so they never repeat. A browser may clear this data under storage pressure; GET /till/device and POST /till/checkin return last_seq, the highest receipt number Stater holds from the till, and the till numbers on from it. A sale counts as sent again only when its seller, time (to the second), lines, total and payments all match the one recorded; a different sale under a used number is refused and kept for a manager. Sent sales are kept for 48 hours for reprinting, then removed.
  • Catalogue copy. The first copy is whole; later ones carry only products changed since the last (a database trigger moves products.updated_at on every change, so imports and cost updates are caught too). After a week, or when too much changed, the copy is whole again.
  • Sending. Waiting sales go oldest first, 20 at a time, with one send at a time across tabs. A sale Stater could not record right now (a server error) is tried again after 5 seconds, doubling to at most 5 minutes. A refused one is kept on the till with the reason. Only Stater's own answer can refuse a sale on the till: an error page from a proxy, firewall or sign-in portal counts as Stater not answering, and the sale is tried again. Waiting sales are sent before the till checks in.
  • Clocks. The till measures its offline window on Stater's clock, worked out at each check-in. A till whose clock is a day or more out stops selling offline until it is fixed.
  • Every replica. Nothing is kept in a server's memory: sales are recorded in their own transactions, orders.offline_ref is unique, and any replica may answer.

API#

The till's own endpoints are under /api/v1/till and use the device cookie, not a token:

Endpoint Needs What
POST /till/enrol a manager's browser session (sell.devices), licence Set this browser up; answers with the cookie and the till
GET /till/device nothing Whether this browser is a till: active, revoked (with refuse_pending) or unknown
POST /till/checkin cookie, a staff session (sell.counter at the till's store), licence Renews that person's pass
GET /till/snapshot?since= cookie, a staff session, licence The catalogue copy, whole or since the last cursor
POST /till/sales cookie and X-Stater-Client Up to 25 sales; each answers recorded, replayed, refused (never recorded) or retry (send again later)
DELETE /till/device cookie (a manager's session for a till still in use) Clear the till

Managers use GET /counter/devices, PATCH /counter/devices/{id}, POST /counter/devices/{id}/revoke and GET /counter/devices/{id}/syncs (all sell.devices). A removed till gets 410 Gone with refuse_pending. Changes to tills are announced on the device.updated topic. Audit actions: device.enrol, device.update, device.revoke, device.wipe, sale.offline and sale.offline_refused.

The sync log is kept for 180 days (the offline_syncs.prune job).

Not yet#

  • Handing a till over to another person while offline.
  • Queuing a sale whose online payment did not get an answer (take payment again only after checking Recent sales).
  • Putting a refused sale through again from the sync log in one step (it shows what was sold and how it was paid, to enter by hand).
  • Downloading a till's unsent sales as a file.
  • A day-close warning while a register's till still holds cash sales.