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

Detailed incoming-payment response data used by listing and completion.

Follows the pinned `incoming-payment` schema: required id, completed,
received_amount, created_at and wallet_address; optional incoming_amount,
expires_at and JSON-object metadata. Omitted optional values become nil;
explicit nulls are invalid. The schema's completed default does not replace its
required-field rule. Amounts become typed `Amount` structs and permitted extra
JSON fields are retained in `extensions`.

URI fields and RFC 3339 timestamps keep their spelling, offsets and precision.
This codec does not compare assets, amount values, timestamps or current time;
operation-level payment consistency checks are separate. Payment methods are
not declared by this detailed schema and remain uninterpreted extensions here.
The create/authenticated-read schema additionally requires payment methods.

Inspection omits amounts, metadata and extensions. Explicit map/JSON exports
contain all protocol data, including any sensitive extension values. The type
makes no requests. Validate modified structs with `validate/1`; `to_map/1`
converts shape without validating it.

# `t`

```elixir
@type t() :: %OpenPayments.Types.IncomingPayment{
  completed: boolean(),
  created_at: String.t(),
  expires_at: String.t() | nil,
  extensions: %{optional(String.t()) =&gt; term()},
  id: String.t(),
  incoming_amount: OpenPayments.Types.Amount.t() | nil,
  metadata: %{optional(String.t()) =&gt; term()} | nil,
  received_amount: OpenPayments.Types.Amount.t(),
  wallet_address: String.t()
}
```

# `from_map`

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

Decodes detailed incoming-payment data without filling schema defaults.

# `to_map`

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

Converts to protocol fields, including metadata/extensions, without validating.

# `validate`

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

Revalidates typed amounts and detail fields, treating nil optional values as omitted.

---

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