Every cross-border store looks healthy for the first month. Then finance tries to reconcile payouts across USD, EUR, GBP, JPY, KRW and SGD against a payment provider dashboard, and the numbers do not close. Not by a few cents — by hundreds.
The usual suspect is not the payment gateway. It is the currency switcher plugin bolted onto the theme.
This article is the architecture I use when a store has to survive an audit: a single ledger currency, integer minor units, exchange-rate snapshots, and a translation layer that does not fight search engines. It is written for teams shipping cross-border storefronts, not for people who just want a pretty currency dropdown.
The failure mode nobody tests
A typical plugin does this: it reads a rate from a third-party API, multiplies the catalog price, and prints a rounded string. Three things break at once.
1. Display price and charged price diverge. The customer sees €84.00, the gateway charges €84.13, because the plugin rounds for display and the gateway rounds for settlement with a different rule. Multiply that by 400 orders a day and your support queue fills with "you charged me more than the price tag" disputes — which, in the EU, is not a dispute you win.
2. Rounding drift accumulates. Store 1,000 products at 3 decimal places and round each display price to 2. The catalog's implied total is no longer the sum of the displayed prices. Every promotion that says "20% off sitewide" now has a different discount rate per currency.
3. Refunds use today's rate, not the order's rate. Customer buys in EUR when EUR/USD was 1.08, refunds three weeks later when it is 1.12. If you refund by re-converting, you book a phantom FX loss on a transaction that never actually moved money.
None of this shows up in a staging test. It shows up in month-end.
Rule 1: one ledger currency, always
Pick a ledger currency — the currency your books are kept in. Every order, refund, payout and fee is stored in that currency, in integer minor units, alongside the currency the customer actually paid in.
order_line { sku qty unit_price_ledger_minor -- integer, e.g. 8450 = 84.50 USD unit_price_display_minor -- integer in the shopper's currency display_currency -- ISO 4217, e.g. "EUR" rate_id -- FK to the rate snapshot used at checkout } Two prices, one order line, and a foreign key that explains the relationship. That single design decision removes most of the reconciliation pain, because you can always answer "what did the customer see, what did we book, and at which rate".
Do not store money as a float. Do not store money as a decimal string and parse it at query time. Integers in minor units, and a currency-aware formatter at the edges.
Watch out for zero-decimal currencies: JPY and KRW have no minor unit. If your code assumes "minor = major × 100", a ¥12,000 product becomes ¥1,200,000 the moment it touches your pipeline. Store the exponent with the currency, not as a global constant.
Rule 2: snapshot the rate, never re-derive it
Exchange rates are not a property of a product. They are a property of a moment.
Keep an append-only table:
fx_rate { id base_currency quote_currency rate_numeric(18,8) source -- provider name fetched_at valid_from valid_to } At checkout, resolve the active rate once, write the rate_id onto the order, and never look at the rate table again for that order. Refunds, partial refunds, chargebacks and accounting exports all read the snapshot. Your books become reproducible: replay the same order a year later and get the same number.
A subtle trap: rate precision. Some providers publish 4 decimals, some 6, some 8. Store at least 8 and round only at the boundary where you must (display, or a gateway that rejects more than 2). Rounding in the middle of a chain of multiplications is where cents disappear.
Rule 3: allocate, don't recompute
Order-level discounts, shipping and tax have to be spread across lines. If you recompute each line's share independently and round, the parts will not sum to the whole — and the residual lands in a mystery account.
Use largest-remainder allocation:
- Compute each line's exact share as a rational number.
- Floor each share to the minor unit.
- Distribute the leftover minor units, one each, to the lines with the largest fractional remainder.
The result always sums exactly to the order total, and it is deterministic — the same input produces the same split on every machine. I have seen a store lose 0.4% of gross margin purely to unallocated rounding residuals across a quarter.
Rule 4: the gateway is not your ledger
Payment providers support multi-currency presentment far more often than multi-currency settlement. Stripe, for example, will let you charge in many currencies while settling into one. That is fine — but it means the rate the gateway used is a second, independent number from the rate you stored.
Record both. Your ledger rate is for your books; the gateway's settled amount is the truth of cash movement. A small settlement_amount field on the payment record, plus a reconciliation job that flags differences above a threshold, turns a monthly argument into a daily exception report.
Rule 5: i18n routing that search engines can crawl
The most common multilingual mistake is not translation quality. It is routing.
Do not redirect by Accept-Language or a cookie. Googlebot crawls from a single locale; a cookie-driven redirect means one language gets indexed and the others effectively do not exist. Instead:
- Give every locale a distinct, stable path:
/,/zh-tw/,/de/, and so on. - Self-referencing canonical on every page.
-
hreflangclusters that point at each other, plusx-default. - No locale in a query string, no locale in a cookie, no JS-only language swap that leaves the URL unchanged.
If a page is not ready to be indexed in a locale, return noindex rather than serving a machine-translated shell. A thin translated page that ranks and converts at zero is worse than no page at all — it drags the whole cluster's quality signals down.
Rule 6: translation as a pipeline, not a document
The workflow that survives growth is:
- One source locale, treated as the single source of truth.
- A key-value dictionary extracted at build time, so missing keys are a build error, not a production surprise.
- Machine first pass, human review for anything customer-facing above the fold — pricing, legal, checkout errors, refund policy.
- A fallback chain that degrades to the source locale silently, never rendering raw keys to a customer.
- Locale-aware formatting everywhere:
Intl.NumberFormatfor money,Intl.DateTimeFormatfor dates,Intl.PluralRulesfor counts. Russian has four plural forms. Arabic is RTL and its numerals may render differently. Hardcoded "1 item / %d items" breaks in most of the world.
If you are running an AI-assisted support layer on top, the same dictionary should feed it. A support bot that invents a refund policy in German because it was never given the reviewed German string is a liability, not a feature.
A minimal test checklist
Before you call a multi-currency store done, these should all pass:
- A JPY order never gains two decimal places anywhere in the pipeline.
- A refund issued 30 days later books at the original rate.
- Order line sums equal order total, to the minor unit, for 10,000 randomized carts.
- Switching locale never changes the URL's indexability, and every locale has a self-canonical plus a complete hreflang cluster.
- Deleting a translation key fails the build.
- The daily reconciliation report shows zero unexplained differences over a gateway threshold.
None of this is exotic. It is just accounting discipline applied to a storefront — and it is the difference between a store that scales into new markets and one that spends every quarter-end explaining variance to a finance team.
I build cross-border storefronts with integer-minor-unit ledgers, locked FX snapshots and locale-safe routing. The full architecture write-up, including the schema and the allocation algorithm, lives here: Multi-currency cross-border e-commerce architecture. If you want the build side, see cross-border e-commerce engineering and fixed-scope pricing.
KESTON is an independent software studio — not affiliated with Keston Boilers, the UK heating brand.
