Skip to main content

Module payment

Module payment 

Source
Expand description

Payment envelopes for the x402 protocol.

JSON is camelCase with deny_unknown_fields. Identifier strings use compact_str::CompactString.

Structs§

Base64Bytes
Raw bytes holding the base64 ASCII of some payload.
Extensions
Canonical x402 extension envelope: extension id → ExtensionEntry.
PaymentPayload
Signed payment authorization sent by the buyer.
PaymentRequired
Body of an HTTP 402 Payment Required response.
PaymentRequirements
Payment terms set by the seller.
PriceTag
Seller-side wrapper around PaymentRequirements.
ResourceInfo
Human-readable metadata describing the paid resource.
SettleRequest
Wire-level settle request. Same JSON as VerifyRequest, distinct type.
SettlementOverrides
Official wire shape for partial settlement.
SupportedPaymentKind
A single payment kind advertised by a facilitator.
SupportedResponse
Response body of a facilitator’s /supported endpoint.
TypedVerifyRequest
Protocol-versioned verify request parameterized by payload and requirements.
U64String
A u64 that serializes as a JSON string.
UnixTimestamp
Unix timestamp in seconds since 1970-01-01T00:00:00Z.
VerifyRequest
Wire-level verify request, stored as opaque JSON.
Version
Compile-time protocol-version marker that serializes as a bare integer.

Enums§

ExtensionEntry
Payload attached to a single extension key.
SettleResponse
Settlement outcome returned by a facilitator.
SettlementOverrideError
Failure resolving a settlement override amount string.
VerifyResponse
Verification outcome returned by a facilitator.

Constants§

DEFAULT_ASSET_DECIMALS
Default ERC-20 style decimals when extra.decimals is absent.
EXTENSION_RESPONSE_LOG_FIELDS
Field names from an EXTENSION-RESPONSES value that may be logged.
V2
Singleton value for Version2.

Functions§

asset_decimals_from_extra
Reads decimals from payment-requirements extra (number or numeric string).
find_matching_requirements
First entry in available that matches accepted.
resolve_settlement_override_amount
Resolves a settlement override amount to atomic units (decimal string).
schema_has_external_ref
true when any $ref or $id is not a same-document # fragment.

Type Aliases§

Version2
x402 v2 version marker.