DocsPayments & workflows
On this page

Currencies and prices

Build a store that shows each shopper the right price, lets them choose a supported currency, and creates an invoice in the currency they reviewed.

Configure your currencies

Site owners choose their base currency and supported shopping currencies in fb-admin → Currency, within the limits of their theme and platform policy. A single-currency site always uses its base currency. Theme management forms can read the effective configuration to show optional currency prices only when they are available.

Frontbacked chooses the active currency in this order:

  1. The visitor's saved choice, if it is still supported.
  2. Their detected country's currency, if supported.
  3. The site's base currency.

Country detection is a suggestion. Visitors can choose another supported currency, and a saved choice takes priority. If the country is unknown, Frontbacked uses the base currency.

Read and change the visitor's currency

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

setCurrency saves the choice in this browser and returns the effective currency configuration. An unsupported choice leaves the current selection unchanged. The choice survives reloads; clearing browser storage removes it. Currency changes update FQL bindings and dispatch frontbacked:currency-change with the effective configuration in event.detail.

Listen on document when custom browser behavior needs to respond:

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

Use a select in your navbar:

index.html

Save prices as money

Declare a money field in FRL. A saved field can contain a base price and optional exact prices in other currencies:

json

Amounts are decimal strings. Currency settings belong to the site configuration, separately from the price. Ordinary money edits merge the submitted currencies into the existing field. When an editor intentionally replaces the complete set of prices, submit { "values": { ... }, "replace": true }. Preserve any prices the editor should retain in that complete set; omitted entries are removed. The saved field contains values, without the replace flag.

Resolve a price

js

Reference excerpt: use this with the page, variables and functions described in this guide. Try a complete example →

The resolver uses the active supported currency. It returns an exact saved price first. Otherwise it converts the base-currency price into that currency. If multiple currencies are disabled or the requested currency is unsupported, it returns the base price. A missing base price or unavailable conversion produces an error; an amount is never simply relabelled as another currency.

Render a price directly in FQL:

index.html

moneyResolve() and moneyFormat() are built-in FQL functions. The price displays a placeholder while a needed rate is loading, and “Price unavailable” when a rate cannot be loaded. Custom theme formatters can use Frontbacked.money.formatCurrent(value, options) for the same loading and error labels. Frontbacked.money.resolveCurrent(value) returns a resolved money value or null while a conversion is unavailable. Use the asynchronous resolve method when an action needs to wait for a price; it also waits for initial country detection.

A page shares its exchange-rate snapshot across prices and fees. A hundred product cards do not make a hundred quote requests. Rates have a short validity period and refresh when a later resolution needs fresh rates. Explicit prices require no conversion-rate request.

Calculate checkout in FRL

The theme's checkout endpoint reads authoritative products and fees, validates quantities and stock, and calculates the final amount. Use the matching FRL resolver:

frl

Rule excerpt: add this to a complete FRL rule before running it. Try a complete example →

money.resolve(value) uses the active requested shopping currency. money.resolve(value, currency) accepts an explicit target and applies the same supported-currency rules. money.exchange(value, currency) remains available for an explicit conversion and rejects a target that the site does not support.

Pass the final money value to payment.create. Keep product validation and business rules in your FRL endpoint. Once created, an invoice keeps its amount and currency, including when someone in another country opens its shared link. Currency selection never changes a recorded order or invoice.