Back to articles
What is the x402 Payment Protocol? A Complete Guide

What is the x402 Payment Protocol? A Complete Guide

via Dev.to WebdevYaqing2023

The x402 payment protocol is an emerging standard for HTTP-native payments that enables machines — particularly AI agents — to pay for services directly over the web without human intervention. The Origin: HTTP 402 Payment Required The x402 protocol gets its name from HTTP status code 402 Payment Required . This status code was reserved in the original HTTP spec for "future use" in digital payments — and that future is now. When a client requests a paid resource, the server responds with: HTTP / 1.1 402 Payment Required X-Payment-Address : 0x... X-Payment-Amount : 0.99 X-Payment-Currency : USDC X-Payment-Chain : base The client then signs a payment transaction and resends the request with payment proof. How x402 Works 1. Client → Server: GET /api/generate-video 2. Server → Client: 402 Payment Required (price: $0.99 USDC) 3. Client: Signs USDC transfer 4. Client → Server: GET /api/generate-video + X-Payment-Proof header 5. Server: Verifies payment on-chain 6. Server → Client: 200 OK + v

Continue reading on Dev.to Webdev

Opens in a new tab

Read Full Article
2 views

Related Articles