Complete an x402 payment
This tutorial walks you through a full x402 payment from HTTP 402 to receipt verification.Prerequisites
- Access to a paywalled endpoint that returns HTTP 402
- A signer capable of Ed25519 signatures
- Sequencer endpoint URL
Step 1: Request a protected resource
Call the resource endpoint and capture theX-Payment-Required header.
Step 2: Build and sign an intent
Create anX402PaymentIntent with payer/payee, amount, network, and validity window. Sign with the X402_PAYMENT_V1 domain separator.
Step 3: Retry with X-Payment
Retry the request with the signed intent in theX-Payment header.