Skip to content

PRD: Omnichannel Sync

ModuleInventoryPRD IDPRD-SYN-001
StatusNo itemFEATSYN
EpicPlane
Date2026-07-13Versionv1.0
Packages@nx/inventoryURDSYN
SurfaceBackendClient · Owner/Mgr
OwnerPhát Nguyễn

What omnichannel sync is

The merchant connects their storefront on an e-commerce marketplace to BANA as an external sale channel (External Channel). From that moment, BANA is the only place that decides how much that storefront still has to sell.

Every external channel draws from exactly one inventory location (InventoryLocation) of one merchant (Merchant). The channel has no stock of its own: it is simply a place that displays the number of the very same stock item.

The four stock numbers

Lifted from Stock Items & Levels so you do not have to open another PRD. Every item at every location carries four numbers:

NumberWhat the system calls itMeaning
On handon-handGoods physically sitting at the location
ReservedreservedAlready promised to another document, no longer sellable to anyone else
AvailableavailableThe part still on offer
IncomingincomingAlready left the source location, not yet arrived at the destination

The invariant, true at every moment:

Available = On hand - Reserved

The marketplace receives exactly the available number, minus a buffer (Buffer) if the merchant sets one.

Why there has to be a single source of stock truth

A restaurant or a retail merchant rarely sells in one place only. The same case of goods in the store room is offered at the counter, on a food-delivery app, and on a marketplace storefront. There is only one store room, but the stock is being promised in three places at once.

Two classic failures show up when there is no single source of stock truth. The first is overselling: a customer orders on the marketplace when the item actually sold out at the counter that morning, and the merchant has to cancel the order and take the reputation hit. The second is phantom stock: two systems write stock to the same storefront, each pushing its own idea of the number, and the figure that finally shows up matches nobody's.

BANA solves this by taking on the role of the single source of stock truth. Every sale channel, the internal counter channels and the marketplace storefronts alike, draws from the same stock table. Orders coming back from the marketplace travel the same sale path as an order at the counter, with no shortcuts.

One item from start to finish

Item Y at location A. The channel is assigned to location A. The buffer starts at 0.

What happensOn handReservedAvailableBufferNumber pushed
Map item Y to the storefront50545045
Set a buffer of 3 on Y50545342
The cashier sells 2 units at the counter48543340
A marketplace customer orders 2 units46541338
The merchant accidentally sets a buffer of 6046541600
  • The number pushed is available minus buffer, floored at 0. A negative number is never pushed.
  • The 5 units reserved for a counter order are never offered for sale on the marketplace.
  • A marketplace order travels the path of a counter order: reserve stock, deduct stock, write the inventory ledger. When it is done, BANA pushes the new number out.

The easiest thing to get wrong

Stock flows one way only, from BANA down to the marketplace

BANA does read back the stock number currently displayed on the storefront, but only to compare it against what it just pushed and raise a warning on a mismatch. The number read back is never written into BANA's stock table.

Writing it back opens the door to phantom stock: the marketplace says 99, BANA records 99, then the next push computes 42 and overwrites it. The two systems fight each other, and the final figure matches nobody.

Consequence: a number someone edits by hand in the marketplace admin console only lives until the next push. To change the number on the marketplace, change the stock or the buffer inside BANA.

Proprietary and Confidential. Unauthorized copying, distribution, or use of this software is strictly prohibited.