Static ReadonlyERROR_Static ReadonlyPAYLOAD_Static ReadonlyRECEIPTS_Static ReadonlyREQUIRED_Static ReadonlySTATUS_Set a Task to the payment-required state (input-required) with the
X402PaymentRequired object in x402.payment.required metadata.
Mutates and returns task (in place), per the x402 v2 A2A transport.
Extract the in-band PaymentPayload object from a Task's status message metadata.
Optionaltask: Task | nullExtract the in-band PaymentPayload object from a Message's metadata.
The payload is untrusted client input that the server re-encodes into an
access token, so this rejects null, arrays and oversized payloads
(defense-in-depth, parity with the MCP readPaymentPayload).
Optionalmessage: Message | nullThe PaymentPayload object, or undefined when absent/invalid.
Extract the X402PaymentRequired object from a Task's status message metadata.
Optionaltask: Task | nullExtract the X402PaymentRequired object from a Message's metadata.
Returns the raw object (already spec-shaped JSON). Returns undefined when
absent or not a plain object.
Optionalmessage: Message | nullExtract the payment status from a Task's status message metadata, or undefined.
Optionaltask: Task | nullExtract the payment status from a Message's metadata, or undefined.
Optionalmessage: Message | nullRecord a deferred (batch) settlement on a Task: the payload was verified but
on-chain settlement is deferred out-of-band (the handler never confirms it).
Sets payment-verified PLUS the Nevermined x402.payment.settlement: 'deferred'
marker, so a client can tell it will be charged out-of-band — distinct from a
plain verify where nothing is owed.
Record a payment failure on a Task: x402.payment.status = payment-failed,
the error code under x402.payment.error, and (when available) the failed
SettleResponse under x402.payment.receipts.
OptionalerrorResponse: SettlePermissionsResultRecord a successful settlement on a Task: sets the x402.payment.status
metadata to payment-completed and stores the SettleResponse receipt under
x402.payment.receipts (an array, per the spec).
OptionalsettleResponse: SettlePermissionsResult
Utilities for managing x402 payment state in A2A messages and tasks.
Provides methods to extract payment status / requirements / payload from incoming A2A messages and tasks, and to stamp payment-required, verified, completed and failed state onto outgoing tasks — all via the spec-defined
x402.payment.*metadata keys.