API reference

Common Data Structures#

PaymentPayload#

After signing, the Buyer passes this to the Seller via the X-PAYMENT header (base64-encoded), and the Seller forwards it as-is to the Facilitator.

ParameterTypeRequiredDescription
x402VersionIntegerYesProtocol version, e.g. 2
resourceObjectNoProtected resource description
resource.urlStringYesURL of the protected resource
resource.descriptionStringNoResource description
resource.mimeTypeStringNoExpected response MIME type
acceptedObjectYesPayment method selected by the Buyer (picked from the accepts array), structure identical to PaymentRequirements
payloadObjectYesSigned data
payload.signatureStringYesEIP-712 signature. exact: EOA signature; aggr_deferred: session key signature
payload.authorizationObjectYesEIP-3009 authorization parameters

Authorization#

ParameterTypeRequiredDescription
fromStringYesPayer wallet address
toStringYesPayee wallet address
valueStringYesPayment amount (atomic units, with precision)
validAfterStringYesUnix timestamp when the authorization becomes valid
validBeforeStringYesUnix timestamp when the authorization expires
nonceStringYes32-byte random nonce (0x hex format, replay protection)

PaymentRequirements#

Used both as an element of the 402 response accepts array and as paymentPayload.accepted.

ParameterTypeRequiredDescription
schemeStringYesSettlement scheme: exact / aggr_deferred
networkStringYesCAIP-2 chain identifier, e.g. eip155:196
amountStringYesPayment amount (atomic unit string)
assetStringYesToken contract address
payToStringYesPayee wallet address
maxTimeoutSecondsIntegerNoMaximum timeout for payment completion (seconds)
extraObjectNoScheme-specific extensions. For aggr_deferred, the Buyer includes the session key certificate in accepted.extra.sessionCert