An amount such as 100 is incomplete without a currency and a unit convention. It might mean one major unit in a two-decimal currency or one hundred units in another representation. Multi-currency systems need an explicit money model and deliberate conversion boundaries. The goal is to keep display formatting, business calculations and provider payloads consistent without assuming every currency or API uses the same decimal rules.

Keep amount, currency and representation together

Use a money type that carries the currency and an exact numeric representation. Integer minor units are useful where the supported currency and operation define them clearly; exact decimal representations may be needed for intermediate calculations. Avoid binary floating-point arithmetic for amounts that must reconcile exactly.

Do not derive all provider payloads from a single generic currency table without checking the integration. Adyen documents its accepted currency codes and minor-unit conventions, including differences that developers must account for. Keep the provider adapter responsible for translating the internal amount into the representation required by that specific endpoint.

Define where rounding occurs

Write a rounding policy for each calculation boundary, such as allocating a discount, converting a currency or producing a final payable amount. Specify the precision and rounding mode. Repeatedly rounding intermediate values can create a different result from rounding once at the intended settlement boundary.

For allocations, ensure the rounded parts sum to the exact original total. Distributing a fixed amount across three items may leave a remainder; assign it through a deterministic rule rather than dropping it. Preserve enough calculation evidence to explain the final amount without relying on a newly computed result under a changed policy.

Treat conversion as a recorded operation

When conversion is part of the product, record source amount, destination amount, rate or quote identity, applicable fees and the time at which the quote was accepted. Keep the customer-visible amount aligned with the amount submitted for payment. A displayed estimate and a confirmed conversion should not share an indistinguishable status.

Distinguish presentment, wallet and settlement currencies. The provider may report a settlement movement in a different currency from the customer transaction. Reconciliation should preserve both amounts and the related conversion or adjustment records. Do not compare unlike currencies by stripping their codes or applying a current rate to explain a historical movement.

Test boundary amounts and reversals

Create examples for zero-decimal and other supported precision conventions, very small values, large permitted values and allocation remainders. Include refunds and reversals, where the correct amount may need to follow the original recorded operation rather than a fresh conversion. Verify the behavior against the actual provider documentation and test environment.

Check display formatting separately from arithmetic. Locale-specific separators and currency placement should not alter the stored amount, and parsing should reject ambiguous input instead of guessing. Retain the policy version used for important calculations. A robust implementation can explain every unit conversion and rounding difference from user entry to provider request and final reconciliation.

TAKE IT FORWARD

The key decisions.

  • Carry currency and exact amount representation together throughout the system.
  • Document rounding boundaries and preserve deterministic allocation remainders.
  • Record historical conversion evidence and test provider-specific minor-unit conventions.

Sources & further reading

Primary references for the concepts discussed. Check the applicable documentation when planning implementation.

  1. Adyen: currency codes and minor units
  2. Stripe: supported currencies