x402 is an HTTP status code that enables AI agents to autonomously pay for API resources using Stellar blockchain payments. The protocol allows servers to request payment without accounts or infrastructure, with agents deciding whether to pay based on budget constraints.

x402 is an HTTP payment protocol that enables AI agents to autonomously purchase API resources on the Stellar blockchain. When an agent requests a paid resource, the server responds with a 402 status code and payment instructions. The agent checks its wallet balance in USDC, signs a payment authorization, and a facilitator bundles the transaction for Stellar settlement. The agent then retries the request with a payment receipt. The implementation requires minimal code, roughly 30 lines of Express middleware, and supports both testnet and mainnet with Freighter wallet integration for human payments.