OpenPayments.Types.CreateOutgoingPayment (open_payments_elixir v1.0.0)

Copy Markdown View Source

The strict payload for creating an outgoing payment using either supported form.

Supply wallet_address with quote_id, or with incoming_payment and a typed debit_amount. These forms are mutually exclusive and no amountless direct form is allowed, matching the pinned oneOf branches and Node's creation argument union. Optional metadata is a JSON object; empty objects are retained.

Map input uses protocol JSON names and permits no additional fields. Variant selection uses field presence, so explicit null cannot silently select another form. In typed structs nil means omission. Explicit map nulls are invalid. URI fields use absolute-URI data validation; incoming_payment does not use the response receiver's incoming-payment path pattern. URI and decimal spelling, permitted nested amount extensions and metadata are preserved.

This codec does not resolve payment pointers, fetch a quote/wallet/receiver, infer amounts, compare wallet assets, require positive values, calculate fees or exchange rates, or apply network request-target policies to URI data. The server needs context to check quote validity, wallet-asset compatibility and authorization. This type makes no requests or payments.

Inspection omits payload fields. Explicit map/JSON exports include wallet, quote/incoming-payment references, amounts and metadata. Errors retain safe field paths without rejected values or unknown names. Validate constructed or modified structs with validate/1; to_map/1 converts without validating.

Summary

Functions

Decodes a strict quote-based or incoming-payment-based creation request.

Exports protocol payload fields without validation, defaults or lookups.

Revalidates the typed variant, references, nested amount and metadata.

Types

t()

@type t() :: %OpenPayments.Types.CreateOutgoingPayment{
  debit_amount: OpenPayments.Types.Amount.t() | nil,
  incoming_payment: String.t() | nil,
  metadata: %{optional(String.t()) => term()} | nil,
  quote_id: String.t() | nil,
  wallet_address: String.t()
}

Functions

from_map(data)

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

Decodes a strict quote-based or incoming-payment-based creation request.

to_map(request)

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

Exports protocol payload fields without validation, defaults or lookups.

validate(request)

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

Revalidates the typed variant, references, nested amount and metadata.