Skip to content

@checkout-kit/core / formatMoney

Variable: formatMoney ​

ts
const formatMoney: ({ amount, currency }, { locale, display }?) => string;

Renders a minor-unit amount the way the locale writes it - where the symbol goes and which character separates the decimals both move by locale.

ts
formatMoney({ amount: 1999, currency: 'USD' }, { locale: 'en-US' }) // '$19.99'
formatMoney({ amount: 1999, currency: 'EUR' }, { locale: 'de-DE' }) // '19,99 €'
formatMoney({ amount: 1999, currency: 'JPY' }, { locale: 'ja-JP' }) // '¥1,999'

Parameters ​

ParameterType
{ amount, currency }Money
{ locale, display }?FormatMoneyOptions

Returns ​

string

Apache-2.0 · Headless engine, provider adapters and runnable examples.