# `PhoenixKit.Modules.Billing.Currency`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/billing/schemas/currency.ex#L1)

Currency schema for PhoenixKit Billing system.

Manages supported currencies with exchange rates for multi-currency billing.

## Schema Fields

- `code`: ISO 4217 currency code (e.g., "EUR", "USD", "GBP")
- `name`: Full currency name (e.g., "Euro", "US Dollar")
- `symbol`: Currency symbol (e.g., "€", "$", "£")
- `decimal_places`: Number of decimal places (usually 2)
- `is_default`: Whether this is the default currency
- `enabled`: Whether currency is available for use
- `exchange_rate`: Rate relative to base currency
- `sort_order`: Display order in currency lists

## Usage Examples

    # List all enabled currencies
    currencies = PhoenixKit.Modules.Billing.list_currencies()

    # Get default currency
    currency = PhoenixKit.Modules.Billing.get_default_currency()

    # Format amount in currency
    PhoenixKit.Modules.Billing.Currency.format_amount(99.99, currency)
    # => "€99.99"

# `changeset`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/billing/schemas/currency.ex#L53)

Creates a changeset for currency creation and updates.

# `convert`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/billing/schemas/currency.ex#L147)

Converts amount from one currency to another.

## Examples

    iex> from = %Currency{exchange_rate: Decimal.new("1.0")}  # EUR (base)
    iex> to = %Currency{exchange_rate: Decimal.new("1.1")}    # USD
    iex> Currency.convert(100, from, to)
    Decimal.new("110.00")

# `format_amount`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/billing/schemas/currency.ex#L93)

Formats an amount with currency symbol.

## Examples

    iex> currency = %Currency{symbol: "€", decimal_places: 2}
    iex> Currency.format_amount(Decimal.new("99.99"), currency)
    "€99.99"

    iex> Currency.format_amount(1234.5, currency)
    "€1,234.50"

# `format_amount_plain`
[🔗](https://github.com/BeamLabEU/phoenix_kit/blob/v1.7.71/lib/modules/billing/schemas/currency.ex#L104)

Formats an amount without currency symbol.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
