Rebasely Beta: data may be purged

examples/storefront Public

Markdown · 21 lines · 837 B · at 94db762

---id: 0003-money-in-whole-centstype: decisionowner: justinstatus: acceptedreviewed: 2026-10-01---# 0003 Money is whole cents## ContextPrices, line totals, shipping and order totals are added and compared in SQL and in TypeScript. Floating point dollars round differently in each place, and payment providers take integer amounts anyway.## DecisionEvery amount is an integer number of cents, in columns and fields named `*_cents`, in one currency (`usd`, `CURRENCY` in `src/money.ts`). Input that is not a whole number of cents is refused, not rounded. Formatting for people happens only at the edge, with `formatCents`.## Consequences- Totals add up the same in D1, in the Worker and at the payment provider.- A second currency is a schema change: a `currency` column on products and carts, and totals per currency.