Skip to content

Currencies: choose what you bill in and set exchange rates

Describes Billing 0.27.0.

The Currencies page lists the currencies Billing can use, which one is the default, and the exchange rates used to convert prices.

Where to find it

Open Billing, then Currencies, at /admin/billing/currencies. It is also a tab of the Billing settings. You need the Manage billing settings permission.

The Currencies tab: EUR as the default, USD and GBP with symbol, decimal places, rounding, exchange rate and status, and Import and Add Currency The Currencies tab: EUR as the default, USD and GBP with symbol, decimal places, rounding, exchange rate and status, and Import and Add Currency

Currencies and their exchange rates.

The table

Each row shows the Currency, Symbol, Decimal Places, Rounding, Exchange Rate, when it was Updated, its Status and whether it is the Default.

“The default currency is used for all new orders. Exchange rates are how many units of a currency one unit of the default currency buys; setting a currency as default renormalizes all rates so its own reads 1.0. Enable only the currencies you plan to accept for billing.”

Row actions:

  • Edit opens the currency form.
  • Enable / Disable switches it on or off. The status badge in the table does the same.
  • Set as Default makes it the default and recalculates every rate so this one is 1.
  • Delete asks Are you sure? first. The default currency can’t be deleted, nor a currency that existing orders use.

Out-of-date rates

A rate not updated for a number of days (30 unless the site changed it) is marked out of date, and a banner, Some exchange rates are out of date, names those currencies. Prices are still converted at the old rates.

Adding currencies

  • Import opens Import Currencies, a list from the ISO 4217 standard of every currency not yet added. Tick the ones you want (or Select All) and press the import button.
  • Add Currency opens an empty form: Currency Code, Name, Symbol, Decimal Places, Exchange Rate, Rounding rule, Sort Order and Enabled. Create saves it; when editing, Update.

Rounding rule “Applies to prices converted into this currency and to cart snapshots — never to the base currency.”:

  • Exact — no psychological rounding
  • Charm .99 — round down to X.99
  • Charm .90 — nearest X.90
  • Whole units — no minor units

What it doesn’t do

  • Exchange rates are not fetched automatically; you enter them. A developer can connect a rate feed, but nothing runs it on a schedule.
  • The number of days after which a rate counts as out of date has no field on this page.

For developers

To refresh rates from a feed, set config :phoenix_kit, :fx_rate_provider, {MyApp.FxFeed, :fetch_rates} (the function returns a map of currency code to rate) and run mix phoenix_kit_billing.refresh_fx_rates, for example from a scheduled job. The out-of-date threshold is the fx_rate_max_age_days setting (default 30).