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

    Function fromCents

    • Convert cents (the currency's smallest unit) to a major-unit amount.

      The currency's minor unit comes from ISO 4217 through minorUnitExponent in payments-core, matched in any case. Every CurrencyCode has two decimals; a code outside it gets its own multiplier (1 for jpy, 1000 for kwd).

      Parameters

      • cents: number

        Amount in the smallest unit

      • currency: CurrencyCode = 'usd'

        Currency code (default: usd)

      Returns number

      Major-unit amount

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

      fromCents(1050); // 10.50
      fromCents(1050, 'gbp'); // 10.50