Group
  • Payments

    Handle multiple currencies without rounding chaos

    Adds correct currency storage, formatting, and conversion rules so international customers see and pay accurate amounts.

    • Improve quality
    • Plan & validate
    • Intermediate
    • General

Free Prompt

My app charges (or is about to charge) customers in more than one currency. Audit and fix how I handle currency everywhere. 1. Storage: every amount in my database must store its currency code alongside it (ISO 4217, like USD, EUR, JPY). An amount without a currency is a bug waiting to happen. Add the column and backfill it. 2. Minor units: amounts must be stored in the currency's smallest unit (cents for USD/EUR, but zero-decimal currencies like JPY have no cents, and a few currencies use three decimals). Do not assume two decimal places anywhere. Use my payment provider's currency metadata for the exponent. 3. Formatting: all display of money goes through Intl.NumberFormat with the correct currency, never string concatenation like a currency symbol glued to amount. Verify JPY and a zero-decimal currency render without fake decimals. 4. Presentment vs settlement: if my provider lets customers pay in their local currency while I settle in mine, document which currency each record is in, and store the exchange rate or converted amount the provider reports so my records reconcile. 5. Consistency: make sure a customer's subscription stays in the currency it started in; plan changes and upgrades must not silently switch currency. 6. Fees and refunds: refunds go out in the original currency at the current conversion, handled by the provider; my records should reference the original transaction rather than recompute conversion myself. Do not convert currencies with hardcoded or scraped exchange rates in my own math; the provider's conversion is the source of truth. Give me: the schema changes, every code path that touches currency with what changed, and test cases for USD, EUR, and JPY covering display, charging, and refund records.

What This Does / How This Helps

Adds currency codes to every stored amount, fixes formatting through proper locale tooling, and makes your provider's conversion the only conversion. Multi-currency breaks in predictable places: amounts stored without a currency so nobody knows what a number means, hardcoded two-decimal formatting that invents cents for yen, and DIY exchange-rate math that disagrees with what Stripe actually charged by enough to make refunds wrong. The prompt standardizes storage in minor units with the currency attached, renders through Intl.NumberFormat, keeps subscriptions pinned to their original currency, and defers all conversion to the provider so your records match your payouts.

Want to skip doing this by hand?

Fortivibe audits your app for all of the areas these prompts cover (and more).

See What We Check

Related Prompts