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

The JSON payload for creating an incoming payment.

Follows `create-incoming-payment-request`: required absolute-URI wallet_address,
optional typed incoming_amount, RFC 3339 expires_at and JSON-object metadata.
Omitted optional fields become nil and are omitted on export; explicit JSON
nulls and additional top-level fields are invalid. Empty metadata is retained.

URI/timestamp spelling and amount data are preserved. This codec does not
resolve payment pointers, fetch a wallet, compare wallet assets, require a
positive amount or compare expiry with the current time. Wallet-asset matching
and other operation-level checks need context beyond this payload.

Inspection exposes only expiry metadata. Explicit map/JSON exports include the
wallet, amount and metadata values. Errors retain safe field paths without
rejected data. Validate modified structs with `validate/1`; `to_map/1` converts
shape without validating it. This type makes no HTTP requests.

# `t`

```elixir
@type t() :: %OpenPayments.Types.CreateIncomingPayment{
  expires_at: String.t() | nil,
  incoming_amount: OpenPayments.Types.Amount.t() | nil,
  metadata: %{optional(String.t()) =&gt; term()} | nil,
  wallet_address: String.t()
}
```

# `from_map`

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

Decodes the strict creation payload and its optional typed amount.

# `to_map`

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

Converts to protocol fields, including metadata, without validating.

# `validate`

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

Revalidates typed payload fields, treating nil optional values as omitted.

---

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