PRD: Receipt templates
| Module | Commerce | PRD ID | PRD-RCP-001 |
| Status | Ready to dev | FEAT | RCP |
| Epic | — | Plane | BANA-1530 |
| Date | 2026-06-15 | Version | v1.0 |
| Packages | @nx/commerce · @nx/core | URD | RCP |
| Surface | Client · Owner/MgrSale · POSBO · Ops | ||
| Owner | Phát Nguyễn | ||
What a receipt template is
Every sale ends in a printed receipt, but merchants do not all want the same one. A coffee merchant wants its logo and a QR code for the loyalty program; a retail counter wants a barcode and a compact line-item table; a multilingual venue wants a Vietnamese receipt at one channel and an English one at another.
A receipt template is a named layout scoped to a merchant or a specific sale channel, and belonging to one language. It is authored in two places: the Owner/Manager designs one for their own merchant right on the Client page, and the operations team designs one on the merchant's behalf in Back Office - both share the same block vocabulary, drag-drop blocks, bind fields, and preview right on the form before saving.
The fixed block vocabulary, and one default per scope and language
A template's layout can only be assembled from a fixed block vocabulary: text, line, image, line-item table, barcode, QR code, and a grid for side-by-side rows. The layout is validated the moment it is saved against exactly this vocabulary - a block type outside the set, or a block missing a required field, is refused before it is stored, so a malformed slip never reaches a printer.
Each scope and language has exactly one default template at any time - promoting a new one automatically retires the old default, with nothing for the merchant to unset by hand.
Why a template surface is needed
Without a template surface, a merchant cannot change the header, reorder sections, add a barcode, or print in a second language without an engineering change. There is also no safe place to store these layouts: a free-form document would let a malformed receipt - a column with no field, a grid that never terminates - slip through and jam the printer at the worst moment, mid-checkout.
One template, from design to printout
A member of the operations team opens Back Office, goes to merchant management, opens the Receipt templates section for a specific merchant, and designs an 80mm receipt: a logo image, a centered merchant name, a dashed separator, a line-item table (name · qty · price), a totals grid, and a QR code bound to the order reference. They mark it the default for Vietnamese. The layout is validated and stored.
At checkout, the cashier on POS completes payment; the system picks the merchant's default Vietnamese template, binds the order's fields and items into it, and renders a 576px-wide monochrome raster the thermal printer prints. Before going live, the cashier had already pressed the Test print button in Printer settings on POS to confirm the printout matched the design.
Later the operations team adds an English template for the merchant's take-away channel and marks it default for English - the previous English default for that channel is retired automatically.
The easiest thing to get wrong
POS never designs or configures a template
The point of sale (POS) has no design or setup function for receipt templates. It only syncs the latest template whenever it is updated on the Client page or in Back Office, then uses exactly that template to print once checkout completes. No editing canvas, no setup form, no "edit template" button anywhere on POS.
Every layout change has to happen on the Client page or in Back Office, then wait for POS to sync - there is no shortcut directly on the point of sale.