Incoming-payment operations on an Open Payments resource server.
Public reads use an unsigned GET to a complete incoming-payment URL and validate the full pinned or minimal public response shape. Resource URLs are opaque: their paths and queries are not inferred from wallet addresses or provider-specific layouts. HTTPS is required unless HTTP was explicitly enabled on the client. Redirects and automatic retries are disabled.
Authenticated reads use a signed GET with a required per-call access token and return detailed data with typed payment methods and consistent amount assets. Creation signs a POST to the resource server's incoming-payment collection and additionally requires zero received funds and completed false in the response. Completion signs a bodyless POST to the payment's complete endpoint and returns detailed payment data with completed true. Listing signs a GET with encoded wallet/pagination query arguments and returns one typed page with consistent amount assets for every item.
Summary
Functions
Marks an incoming payment complete using a signed POST without a request body.
Creates an incoming payment using a signed POST and a per-call access token.
Fetches authenticated incoming-payment details using a signed GET.
Fetches public incoming-payment details without signing or an access token.
Lists one page of incoming payments using a signed GET.
Functions
@spec complete(OpenPayments.Client.t(), String.t(), [ {:access_token, String.t() | OpenPayments.Types.AccessToken.t()} ]) :: {:ok, OpenPayments.Types.IncomingPayment.t()} | {:error, OpenPayments.Error.t()}
Marks an incoming payment complete using a signed POST without a request body.
Supply the full incoming-payment URL and the required per-call access_token
option accepted by get/3. The SDK appends /complete, preserving tenant and
opaque path spelling and reusing an existing trailing slash. Queries, including
an empty query marker, are rejected. Request URL policies still apply.
HTTP 200 returns a typed OpenPayments.Types.IncomingPayment with completed true
and consistent incoming/received asset code and scale, following Node's checks.
The completion response excludes payment methods and other unknown top-level
fields. The pinned response's additionalProperties restriction is applied to
the combined detailed fields, rather than literally closing an allOf reference
with no locally declared properties. Metadata and nested amount extensions are
still permitted. The standalone detailed codec keeps its extension support.
Invalid success data returns decoding/invalid_response with status 200. Errors
carry :complete_incoming_payment. The server checks grant permissions, expiry
and completion eligibility; the SDK does not require the full amount to have
been received or compare returned identity/timestamps with local state.
No automatic retry, redirect, token refresh or readback occurs, including after
ambiguous transport failures. The caller decides how to reconcile the outcome.
@spec create( OpenPayments.Client.t(), String.t(), OpenPayments.Types.CreateIncomingPayment.t() | map(), [{:access_token, String.t() | OpenPayments.Types.AccessToken.t()}] ) :: {:ok, OpenPayments.Types.IncomingPaymentWithMethods.t()} | {:error, OpenPayments.Error.t()}
Creates an incoming payment using a signed POST and a per-call access token.
Supply the resource-server base URL, a typed CreateIncomingPayment or a
string-keyed protocol map, and the required access_token option accepted by
get/3. The SDK appends /incoming-payments, preserving tenant paths and
reusing an existing trailing slash. Base URLs with queries are rejected.
HTTPS is required unless HTTP was explicitly enabled on the client.
Success requires HTTP 201 and a detailed response with payment methods, zero
received funds, completed false and consistent incoming/received assets,
following Node's creation checks. Invalid success responses return
decoding/invalid_response with status 201. Errors carry :create_incoming_payment.
Wallet/amount/expiry/metadata values are sent as supplied. No wallet is fetched to compare its assets; the server enforces wallet asset compatibility and grant permissions. The response is not compared with request values. No automatic retry occurs, including after a timeout; a failed call may have created a payment. Explicit response exports include ILP shared secrets.
@spec get(OpenPayments.Client.t(), String.t(), [ {:access_token, String.t() | OpenPayments.Types.AccessToken.t()} ]) :: {:ok, OpenPayments.Types.IncomingPaymentWithMethods.t()} | {:error, OpenPayments.Error.t()}
Fetches authenticated incoming-payment details using a signed GET.
Supply the complete resource URL, an authenticated client and the required
per-call access_token option as an opaque string or typed AccessToken.
Typed tokens are revalidated before using their value; opaque token permissions,
expiry and key binding remain the server's responsibility. Other options and
typed continuation credentials are rejected. Request URL/token68 rules apply.
Success requires HTTP 200 and the detailed response with typed payment methods.
When incoming_amount is present, its asset code/scale must match received_amount,
following Node's authenticated incoming-payment validation. Invalid schemas or
inconsistent response assets return decoding/invalid_response with safe fields;
errors carry :get_incoming_payment and applicable status.
No path is appended, no identity/amount/expiry equality with the requested URL
or token metadata is inferred, and no state is cached. This call does not create
or complete a payment. Explicit exports include ILP shared secrets; inspection
omits them. Public reads remain available separately through get_public/2.
@spec get_public(OpenPayments.Client.t(), String.t()) :: {:ok, OpenPayments.Types.PublicIncomingPayment.t()} | {:error, OpenPayments.Error.t()}
Fetches public incoming-payment details without signing or an access token.
Accepts a full resource URL, including a nondefault HTTPS port or query if
needed. Payment pointers identify wallets and are not resource URLs. Success
returns a PublicIncomingPayment struct; errors carry the operation
:get_public_incoming_payment and applicable status or validation paths.
Minimal public responses supply auth_server and optionally received_amount;
detail fields remain nil. A response containing any payment detail must satisfy
the full pinned schema. No missing fields are inferred from the request URL.
This read does not complete or create a payment, connect to STREAM, select a payment method, or cache the response. Explicit JSON exports of returned methods contain ILP shared secrets; inspection omits them.
@spec list(OpenPayments.Client.t(), String.t(), String.t(), access_token: String.t() | OpenPayments.Types.AccessToken.t(), pagination: OpenPayments.Types.Pagination.t() | map() ) :: {:ok, OpenPayments.Types.IncomingPaymentPaginationResult.t()} | {:error, OpenPayments.Error.t()}
Lists one page of incoming payments using a signed GET.
Supply the resource-server base URL and wallet filter separately. The required
access_token option accepts the same raw string or typed token as get/3.
Optional pagination accepts a typed Pagination or string-keyed map; omission
sends no cursor/count defaults, while explicit nil is invalid. Other options,
duplicate keys and per-call key/header overrides are rejected.
The wallet filter follows the pinned required-string query schema, without URI validation or payment-pointer resolution. Use the discovered wallet ID for normal requests. Every UTF-8 string, including empty, is encoded and sent as wallet-address; provider meaning and permissions remain server checks. Unlike Node's truthy-value filtering, an empty wallet string is not silently omitted.
Appends /incoming-payments to the base while preserving tenant paths and
reusing a trailing slash. Base queries are rejected. Query values use Node's
URLSearchParams form encoding, with a stable wallet-address-first order and
sorted pagination keys. Encoding finishes before signing the complete target.
HTTP 200 returns IncomingPaymentPaginationResult and requires incoming/received
asset code and scale consistency for every item, following Node. Schema or
consistency failures return decoding/invalid_response with safe indexed fields
and status 200. Errors carry :list_incoming_payments.
This call does not infer result ordering, compare wallet identities or page sizes, cache responses, fetch another page, follow links/redirects, retry or refresh tokens. The caller chooses cursor/direction for each subsequent call. Explicit page exports include cursors, metadata and extensions.