Mazmunga ötiş
saidqodirxon.uz
← Barça yozuvlar

POS Offline Mode: Keep Selling When the Internet Drops

An online-only POS stops working the moment the internet drops: the cashier can't issue receipts and the line keeps growing. An offline-capable system writes each sale to a local database on the device and sends the receipts to the server automatically once the connection is back. The hardest part is syncing, and the key to doing it reliably is a unique ID for every receipt.

Why is an online-only POS risky?

If every sale depends on a server request, any network hiccup stops the checkout. Customers won't wait. The cashier has to write sales on paper or turn buyers away. Entering those records manually later leads to errors and lost data.

Recommendation: if the shop, café or warehouse can't count on a stable connection, don't build an online-only architecture.

How does offline mode work?

A sale is first written to local storage on the device, not to the server. In a web app this is usually IndexedDB; in a desktop or mobile app, something like SQLite. Each receipt goes into a queue marked as not yet sent. The cashier keeps working regardless of the connection.

Recommendation: let the UI read from the local database and sync with the server in the background. This approach is called local-first.

How should syncing be organized?

When the connection returns, the app sends queued receipts in order. A receipt is marked as sent only after the server confirms it. If no response arrives, the request is retried. That retry is exactly where duplicates come from: the server may have saved the receipt, but the response got lost on the way back.

Recommendation: make the queue persistent so it survives app restarts and device reboots.

Why does every receipt need a unique ID?

The ID is generated on the device at the moment the receipt is created, for example a UUID. If the server receives the same ID twice, it doesn't record a new sale; it returns the earlier result. This is called idempotency, and it guarantees a sale is never recorded twice.

Recommendation: add a unique constraint on the ID column in the database. Don't rely on the server to assign receipt numbers, because offline there is no server.

How do you handle stock and price conflicts?

While offline, two registers can sell the last unit of the same product. A price may change on the server while a register still shows the old one. Decide in advance how such cases are resolved, for example by allowing stock to go negative temporarily and flagging it in reports.

Recommendation: store sales as immutable events and calculate stock from those events.

What should the cashier see?

Show the connection status and the number of unsent receipts on screen. A cashier who knows the system is working offline stays calm and doesn't ring up a sale twice. Sync errors should never be silent; display a clear message.

Recommendation: during testing, cut the internet on purpose, restart the device, and verify that every receipt reaches the server exactly once.

Key takeaways

  • An online-only POS stops sales when the internet goes down.
  • In offline mode, sales are saved locally and sent to the server through a queue.
  • Give every receipt a unique ID generated on the device so no sale is recorded twice.
  • Define upfront how stock and price conflicts are resolved.
  • Design offline mode from day one; adding it later is much harder.

Frequently asked questions

Can offline mode be added later?

Yes, but it's costly. You'll have to rework the data flow, ID generation and the server API.

Can a web-based POS work offline?

Yes. A Service Worker caches the app, and IndexedDB stores the sales. Together they let a browser-based POS run without internet.

Do receipt numbers have to be sequential?

For the internal ID, uniqueness is enough. If you need a visible sequential number, use a separate prefix for each register.

Is offline mode compliant with fiscal rules?

It depends on local regulations and the fiscal module you use. Check those requirements separately before you design the system.


Telegram | LinkedIn | Instagram | Website

View on Instagram ↗View on Telegram ↗