Resources · 94

Commerce: verify currency amounts and rounding

Reconcile displayed prices, orders, payments and refunds without mixing units.

· 3 min

Smartphone and laptop on a table Illustration · fictional scene

What this guide helps achieve

  • Attach currency to amount
  • Follow provider units
  • Separate calculation and display
  • Specify rounding policy
  • Reconcile every output

Quick check

  • Do all currencies use two decimals?
  • Does Intl.NumberFormat calculate price?
  • How should a leftover cent be assigned?

Step-by-step method

  1. 01

    Attach currency to amount

    Store value and currency code together. Distinguish presentment from settlement currency. Never sum euros and yen; conversion needs an explicit rate, date and rule.

    Output: Amounts paired with currency.

  2. 02

    Follow provider units

    Stripe expects amounts in the unit defined for each currency. Check exceptions. Its examples use 1099 for 10.99 USD and 10 for 10 JPY. Do not universally multiply by 100.

    Output: Unit contract per operation.

  3. 03

    Separate calculation and display

    Use exact decimal representation or integers suitable for the contract. Localised formatting does not establish the reference value. A displayed string with separators is not a reliable technical amount.

    Output: Separate exact values and display.

  4. 04

    Specify rounding policy

    Document line or total rounding, discount allocation and residuals. Validate tax and document rules for the applicable context. Replay quantities, partial refunds and edge cases without silently switching policy.

    Output: Rounding policy and edge cases.

  5. 05

    Reconcile every output

    Compare currency, units, totals and identifiers across basket, order, notification, invoice and refund. Check amounts server-side. A correctly formatted screen can conceal an incorrect payment request.

    Output: Reconciliation across systems.

Fictional acceptance-test scenarios

These proposed cases are not client observations. Adapt data, permissions and acceptance criteria to your authorised environment.

Situation to exerciseResult to checkEvidence to retain
Three lines each have a fictional pre-rounding amount of 0.335.Define precision and the applicable rule before comparing rounded-line sums with a rounded total; do not select rules to obtain a preferred outcome.Exact amounts, operation order and documented rule.
An API receives an amount in another currency.Check currency, expected unit and provider exceptions; do not universally multiply by 100.Payment contract and a payload without sensitive data.
Two partial refunds concern the same capture.Reconcile confirmed amounts, currency and history to prevent over-refund or duplication.Stable identifiers, states and confirmed refunded total.

Reusable worksheet

Complete with your authorised observations. These fields are a working template, not observed results.

FieldInformation to record
AmountExact value, currency and unit
CalculationQuantities, discounts, tax and rounding
PaymentContract, submitted and received amounts
AcceptanceDifferences, edge cases and refunds

Worked example

Illustrative situation

Fictional EUR example: splitting €10.00 into three €3.33 lines leaves one cent unallocated.

Decision and expected evidence

The selected rule assigns that cent to a defined line and preserves a €10.00 total. This is not a universal tax rule.

Distinguish the mechanisms

MechanismPurposeCheck or limitation
Calculation valuePerform an exact operationDocument precision and rounding
API amountFollow provider contractCurrency-specific unit
Localised displayPresent amount and symbolNot an accounting calculation

Management indicators

IndicatorWhat it measuresFirst action
Total discrepanciesDifferences between systemsReconcile before confirmation
Currency casesSupported currenciesTest each distinct contract
ResidualsAllocation differencesApply documented policy

Common pitfalls

  • Document precision and rounding
  • Currency-specific unit
  • Not an accounting calculation

Frequently asked questions

Do all currencies use two decimals?

No. Check current provider contract and currency rules, including operation-specific exceptions.

Does Intl.NumberFormat calculate price?

It formats a value. Define calculation, taxes, discounts and rounding beforehand.

How should a leftover cent be assigned?

Use a validated, reproducible allocation rule. Retain the reference total and line breakdown.

Official references

References consulted: . The method and worksheet propose checks to adapt to your context; they do not constitute certification.