How it works
A client requests a paid resource and receives a 402 response whose PAYMENT-REQUIRED header lists the accepted payment schemes, price, network, and destination address. The client signs a payment and repeats the request with it in a PAYMENT-SIGNATURE header. The server verifies and settles the payment itself or through a facilitator's /verify and /settle endpoints, then serves the response.
Because the whole exchange happens over HTTP, a program can pay without a human filling in a form, which suits AI agents that call many APIs on a user's behalf. Stablecoin payments are the primary use case, and the protocol supports EVM chains and Solana. The HTTP standard defines 402 but reserves it "for future use"; x402 gives it a concrete meaning.
Example
An agent requests a report endpoint and gets a 402 saying the call costs 0.05 USDC on Base. It signs a 0.05 USDC authorisation and retries. The facilitator verifies and settles it, the server returns the report, and the seller's wallet receives 0.05 USDC with no account or card involved.
x402 in Cred
cred.diy speaks x402 version 2 in both directions: agents can buy credits by paying, or pay inline for an individual API call. Stablecoin payments settle to your own wallet, so x402 works for businesses a card processor will not take.
Agent Payments (x402) docsQuestions
- Does x402 require a crypto wallet?
- Yes. The paying client needs a wallet holding the stablecoin, and the seller needs an address to receive it. Agents typically use a wallet funded by the person or company they act for.
- Is x402 only for AI agents?
- No. Any HTTP client can use it. Agents are the main use case because they cannot easily complete card checkouts or create accounts.
- What does a seller need to accept x402?
- A wallet address to receive stablecoin, a server that returns 402 responses with price details, and a facilitator to verify and settle payments.