Menu

Server-Authoritative Pricing: The Browser Can Preview a Bill, Not Decide It
📰

Server-Authoritative Pricing: The Browser Can Preview a Bill, Not Decide It

DEV Community: typescript·Raktim Ranjit·about 1 hour ago
#ZGHEFF8g
#devtotypescript#devto#dev#total#client
Reading 0:00
15s threshold

A point-of-sale screen needs to feel immediate. That is why it previews prices in the browser. But a preview should never be the authority for what a customer owes.

In OrderRestro, the client mirrors the pricing calculation so the cashier can see a responsive total. When the order is submitted, the server recalculates the amount using trusted menu and order data. Tax, discounts, and rounding are handled on that authoritative path.

This split is useful well beyond POS software: let the interface help the user understand what will happen, then validate again at the boundary that persists money or permissions. If the server accepts a total supplied by the browser, anyone can modify the request and change the amount without changing the UI.

A simple review exercise is to alter the submitted total in a test request. The server should either ignore the client’s total and derive its own, or reject the mismatch.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.