# `AshMoney.Types.Money`
[🔗](https://github.com/ash-project/ash_money/blob/v0.2.6/lib/ash_money/types/money.ex#L5)

A money type for Ash that uses the `ex_money` library.

When constructing a composite type, use a tuple in the following structure:

`composite_type(%{currency: "USD", amount: Decimal.new("0")}}, AshMoney.Types.Money)`

If you've added a custom type, like `:money`:

```elixir
composite_type(%{currency: "USD", amount: Decimal.new("0")}, :money)
```

## Constraints Options

* `:storage_type` (`t:atom/0`) - The storage type for the money value. Can be `:money_with_currency` or `:map`. There is no difference between the two unless `ex_money_sql` is installed. The default value is `:money_with_currency`.

* `:ex_money_opts` (`t:keyword/0`) - `ex_money` Money.new/3 Options - https://hexdocs.pm/ex_money/Money.html#new/3-options

* `:min` - Enforces a minimum on the amount

* `:max` - Enforces a maximum on the amount

### Example
```elixir
attribute :charge, :money do
  constraints: [
    min: Decimal.new("0"),
    max: Decimal.new("1000"),
    ex_money_opts: [
      no_fraction_if_integer: true,
      format: :short
    ]
  ]
end
```

# `handle_change?`

# `prepare_change?`

---

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