# `OpenPayments.Types.Quote`
[🔗](https://github.com/interledger/open-payments-elixir/blob/v1.0.0/lib/open_payments/types/quote.ex#L1)

Quoted amounts for an outgoing payment, with typed debit and receive amounts.

Follows the pinned quote schema: required absolute-URI id and wallet_address,
HTTP(S) incoming-payment receiver, debit_amount and receive_amount, method ilp
and RFC 3339 created_at. Optional expires_at is a string: the schema declares no
date-time format for it, so this codec preserves it without parsing or comparing
it with the current time. Omission becomes nil; explicit null is invalid.

Additional top-level fields are forbidden, including sentAmount, which appears
in inconsistent standalone schema examples. Both response amounts are required;
one such example also omits receiveAmount. Valid GET/create operation examples
satisfy the declared schema without repair. Permitted amount extensions remain
intact, and URI, timestamp and decimal spelling are preserved.

Debit and receive amounts may use different assets. This codec does not compare
amounts, infer exchange rates or fees, enforce positivity or elapsed expiry,
fetch wallet/receiver data, sign requests or create payments. Creation-request
amount variants are separate from this response type.

Inspection exposes only id, method and created_at. Explicit map/JSON exports
include wallet, receiver, amounts and expiry data. Errors contain safe field
paths without rejected values or unknown field names. Validate modified structs
with `validate/1`; `to_map/1` converts without validating.

# `t`

```elixir
@type t() :: %OpenPayments.Types.Quote{
  created_at: String.t(),
  debit_amount: OpenPayments.Types.Amount.t(),
  expires_at: String.t() | nil,
  id: String.t(),
  method: String.t(),
  receive_amount: OpenPayments.Types.Amount.t(),
  receiver: String.t(),
  wallet_address: String.t()
}
```

# `from_map`

```elixir
@spec from_map(map()) :: {:ok, t()} | {:error, OpenPayments.Error.t()}
```

Decodes strict quote response data and both required typed amounts.

# `to_map`

```elixir
@spec to_map(t()) :: map()
```

Exports protocol fields, including wallet/receiver/amount data, without validating.

# `validate`

```elixir
@spec validate(t()) :: :ok | {:error, OpenPayments.Error.t()}
```

Revalidates fields and typed amounts, treating nil expiry as omitted.

---

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