---
url: >-
  https://game-engine-io.github.io/enginex-frontend-sdk/reference/api/@getenginex/sdk/functions/formatMoney.md
---
[Reference](../../../index.md) / [@getenginex/sdk](../index.md) / formatMoney

# formatMoney()

> **formatMoney**(`amountMinor`, `currency`, `locale?`): `string`

Formats an amount in minor units with `Intl.NumberFormat`, using the currency's decimal places.
Accepts negatives (balance, statement). Without `locale`, the runtime's applies: in SSR, pass the same
`locale` on the server and in the browser to avoid a hydration mismatch.

## Parameters

### amountMinor

`number`

Amount in minor units (a safe integer), e.g. `123456` = R$ 1.234,56 when formatted for pt-BR.

### currency

[`CurrencyInfo`](../interfaces/CurrencyInfo.md)

The operator's currency (`config.currency`).

### locale?

`string`

BCP 47 locale, e.g. `pt-BR`. Default: the runtime's.

## Returns

`string`

## Example

```ts
const { currency } = await enginex.config.get()
formatMoney(123456, currency, 'pt-BR') // 'R$ 1.234,56'
```

## Throws

`amountMinor` is not a safe integer or `decimalPlaces` is invalid.
