x402 v2 purchase of a plan in one payment (`depositAndSubscribe(tier_id, months, max_price, ref)`).
POST/v1/x402/purchase
The beneficiary is always the payer (contract rule). ref = the quote id, bound under the payer's
signature. Quote verification, payment-identifier persistence and the pause answers follow the
cross-host rules listed under POST /v1/x402/topup.
Request
Responses
- 200
- 202
- 400
- 402
- 429
- 503
Payment executed and subscribed event mirrored.
Response Headers
x402 v2 - base64 of a JSON X402SettlementResponse.
Pending, poll.
MALFORMED_REQUEST, VARIANTS_NOT_SUPPORTED, RELAYER_SIGNATURE_PRESENT, CHAIN_ID_MISMATCH, TX_VERSION_UNSUPPORTED, TX_OPTIONS_UNSUPPORTED, LEASE_MISSING, CURSOR_INVALID.
Response Headers
Request id, also the instance of a problem document and the log correlation id.
x402 challenge (unpaid request) or failed payment (PAYMENT-RESPONSE with success=false). Also used for INSUFFICIENT_CREDITS.
Response Headers
x402 v2 - base64 of a JSON X402PaymentRequired.
x402 v2 - base64 of a JSON X402SettlementResponse.
RATE_LIMITED, GAS_BUDGET_EXCEEDED, HOURLY_BURN_EXCEEDED, TOO_MANY_IN_FLIGHT, QUOTA_EXHAUSTED (the latter without Retry-After; details.reason = CAP_REACHED_PAYG_OFF | PAYG_ESCROW_EMPTY).
Response Headers
Seconds (HTTP standard). Millisecond precision is in details.retryAfterMs of the problem body.
Requests (or RU on the relay path) allowed in the current window.
Remaining units in the current window.
Seconds until the window resets (IETF RateLimit header fields).
SWAP_VENUE_PAUSED (the exchange venue is paused), CONTRACT_PAUSED (the CoRelayer contract is paused: paused or deposits_paused; it is never reported as SWAP_VENUE_PAUSED), SWAP_BUDGET_EXHAUSTED, FREE_FLOW_UNAVAILABLE, NO_RELAYER_AVAILABLE, UPSTREAM_UNAVAILABLE (the x402 routes also return it when they cannot read their payment records), SIGNER_UNAVAILABLE, SIGNER_FENCED, SIGNER_TIMEOUT. All are answered before the commit point.
Response Headers
Seconds (HTTP standard). Millisecond precision is in details.retryAfterMs of the problem body.