SHAM Digital, homeStart a Conversation

Selling through the outage

How Mauzo keeps a Tanzanian shop selling when the network drops, and what that asks of the design.

Most shops and restaurants we build for still run on a counter book, a calculator and the owner’s memory. Mobile money is reconciled by scrolling through SMS. An owner cannot see what a branch sold without standing in it.

Imported point of sale systems tend to assume a constant connection, card payments and English. None of those hold at the counter of a Tanzanian duka. Mauzo, our point of sale and back office for shops, restaurants and retailers, starts from the opposite assumption. The network will drop, probably at the busiest hour, and the shop has to keep selling.

A till that stops gets unplugged

Many Tanzanian shops still sell on slow 2G connections, or on no connection at all for part of the day. Our business case for Mauzo draws a short conclusion from that: a till that stops when the network does is a till that gets unplugged. A cashier who has turned a customer away because the screen was waiting on a server stops trusting the till, and the counter book comes back.

So the Mauzo requirements make offline selling a Must from the first release. During a disconnection the till is the source of truth. Selling, refunds, stock movements and closing a shift all work with no network, and everything is queued for later. The acceptance tests are concrete. A till cut off for eight hours keeps trading and loses nothing when it reconnects. A till offline for 72 hours drains its queue without anyone touching it. A full day of server outage does not stop a single till.

The network will drop, probably at the busiest hour, and the shop has to keep selling.

What lives on the device

The till holds the catalogue, the cart, payment capture, the shift and its stock movements, with an outbox of everything not yet sent. The local store is append only and has to survive a crash, a restart and a flat battery. The requirements test it by killing the app at a hundred random points: it may lose the sale in progress, never the store.

Some things deliberately do not live on the device. The books never run on the till. A till that posts its own journal entries cannot be reconciled when two tills disagree, and an immutable ledger spread across several phones is not immutable. The till sends events, and the server turns them into one set of books per business.

Stock follows the same idea. The system design treats a stock level as the sum of its movements, never as a number each till edits. Two tills that sell the last crate of soda while offline each record a movement. When they reconnect the server adds both up, and nothing is overwritten. The business case calls it the single best decision in the design.

Paying without a signal

Cash works offline. Mobile money is harder, because a payment prompt has to reach the network. When it cannot, the Mauzo till offers a plain fallback: “No network? Enter the M-Pesa code instead.” The cashier types the transaction code from the customer’s confirmation SMS, and the payment is recorded against the sale with a status of to verify until it can be checked.

That status matters. A pending payment is shown in a neutral colour and never in green, so nobody reads it as confirmed. Receipts get the same honesty. A shop with no printer is a supported setup, and the receipt can go by SMS or WhatsApp instead. With no connection, the till says the receipt will go with the next sync, not that it was sent.

A pending payment is never shown in green.

The receipt number problem

Offline selling meets the law at the receipt. Tanzanian rules require a fiscal receipt number to equal the device’s global counter, to go up by exactly one each time, and never to skip or reuse a number. The original system design numbered receipts by outlet, device and a local sequence, so that two offline tills would never collide. Under a single fiscal registration, that cannot meet the counter rule.

The Mauzo requirements set out four ways through, and reject three of them:

  • Let the server allocate every fiscal number. Rejected, because it destroys the offline property.
  • Let one till post fiscal receipts and have the others feed it. Rejected, because a second till becomes useless when the first is offline, which is exactly when a shop needs it.
  • Hand each till a block of numbers in advance. Rejected, because an unused block leaves a gap, and gaps are the problem.
  • Give each till its own fiscal registration and its own counter. Recommended, because it keeps offline selling intact.

The recommended option depends on the revenue authority permitting several virtual registrations at one premises. The requirements treat that as an open question to put to the authority in writing before any fiscal code is written, and they specify a fallback if the answer is no. Fiscal receipting is not yet integrated in the till, and the requirements forbid any screen or document from claiming an approval the product does not hold.

One rule stands either way. When a sale cannot be given a fiscal number at the counter because the till is offline, the sale still completes. The customer is not refused because the network is down. The sale is queued, and the slip tells the customer in Kiswahili and English whether it is the fiscal receipt or a provisional one.

Two kinds of waiting

That rule creates a distinction the owner has to see. A record waiting to upload is an inconvenience. A receipt waiting for a fiscal number is a compliance matter. The Mauzo requirements keep the two apart. Every till shows when it last synced and how many records are waiting, and warns when the queue grows old. Separately, the owner can see how many receipts are awaiting a fiscal number.

The Android till in field testing already shows the first half. The status line reads “Offline · selling works” when the signal goes, and closing a shift checks that every sale has been sent. The till also refuses to move to another device while changes are still waiting, because moving would lose them.

Never locked out of your own records

Mauzo is sold by subscription, and licensing is where offline software often turns on its users. The system design signs each device’s licence and checks it on the device at every launch, so the till needs no server to start. Activation needs internet once. After that the till works offline, and there is a grace period when a renewal cannot reach the server.

The requirements add one rule to the design: when a licence lapses, the till degrades to read only. A shop can always read its own records and close its day. Its data is never held hostage to a payment.

Built for the counter

The rest reads like notes taken at a counter. A three line sale, payment included, completes in under fifteen seconds. A cashier signs in with a short code in under three seconds, because a shift change should not need a password typed on a touch keyboard. A product with no barcode is fully usable, because most of the market has none. Prices are in shillings with no decimals. The total and the change are the largest things on the payment screen, legible across a counter in sunlight. Kiswahili is the default language, and no screen falls back to English.

What we still have to prove

Mauzo version 0.3 is in field testing on Android. The web back office and the desktop app are in development. The fiscal questions above are still open, including how long the authority allows between a sale and its fiscal receipt. We will write about what field testing changes once we have results worth reporting.

The principle will not change. A shop sells when it has customers, not when it has a signal.