Introduction
HTTP 402 Payment Required is for responses where the client must pay (or otherwise satisfy payment terms) before accessing a resource. Stacks built on 402 use it for machine-to-machine traffic and agents: the client requests an API, receives payment requirements instead of the payload, fulfills them with a wallet (and retries as the protocol defines), and the server returns the resource after verification and settlement. Exact headers, payloads, and settlement differ by protocol; you avoid redirects and hosted checkouts for many of these flows.How 402 payment flows work
Most stacks follow the same shape:- Request: Client calls an HTTP API
- 402 response: Server returns payment requirements instead of the resource
- Payment: Client signs or builds payment proof and retries (mechanism is protocol-specific)
- Verification: Server or a service validates the payment
- Settlement: Funds or state update onchain (or per your stack)
- Delivery: Server returns the requested resource
Buyers and sellers
For buyers
- Often no accounts: Requirements are carried in the HTTP exchange instead of a separate signup
- In-request payments: Pay as part of calling the API
- Wallet options: Embedded wallets, external wallets, or server wallets with Dynamic
- Programmatic: Fits agents and automated clients
For sellers
- API-native pricing: Charge per request, call, or resource
- Minimal checkout UI: Many flows need no separate payment page
- Usage-based models: Micropayments and pay-per-use access
Dynamic’s role
Dynamic provides wallet infrastructure—signing, key handling, embedded and external wallet connectivity, and server wallets—for 402-style integrations. Wire format, headers, and settlement are defined by the protocol you integrate (for example x402 or Tempo MPP).Use cases
- AI billing: Per inference or API call
- API monetization: Usage-based access instead of flat subscriptions
- Autonomous agents: Automatic payment for services
- Micropayments: Per article, video, or data point
- Premium content: Access after payment in the same request flow
Integration paths
Dynamic documents two 402 stacks:- Using Dynamic with x402 — The x402 protocol, facilitator tooling (for example Coinbase Developer Platform), and official
x402-fetch/x402-axiosclients. Use this path for x402-protected APIs and CDP-style facilitators. - Machine Payments on Tempo (Node.js) — Tempo Machine Payment Protocol (MPP) with Dynamic’s Node SDK and the
mppxclient. Use this path when your API or settlement targets Tempo.