@bates-solutions/clover API Reference - v1.3.0
    Preparing search index...

    Function formatMoney

    • Format money for display.

      The amount is read with fromCents, so it follows the same ISO 4217 rules: every CurrencyCode has two decimals, and an untyped caller's jpy shows 1000 as ¥1,000.

      Parameters

      • cents: number

        Amount in the currency's smallest unit

      • currency: CurrencyCode = 'usd'

        Currency code (default: usd)

      • locale: string = 'en-US'

        Locale for formatting (default: en-US)

      Returns string

      Formatted currency string

      When currency is not a string, or is empty or only whitespace

      formatMoney(1050); // "$10.50"
      formatMoney(1050, 'gbp', 'en-GB'); // "£10.50"