Macaroon is reusable. Preimage proves payment — SHA256(preimage) matches the invoice's payment_hash caveat.
5Server → Agent200 OK + resource
0 of 5 steps need permission
x402
L402
Trust model
Facilitator required
No intermediary
Verification
Remote (Facilitator API)
Local (HMAC + SHA256)
Privacy
On-chain visible
Off-chain, onion-routed
Credential
Single-use signature
Reusable macaroon
Currency
USDC (stablecoin)
Bitcoin (sats, volatile)
Client gas
None (facilitator pays)
N/A
Settlement
~2s (Base L2)
~1-2s (Lightning)
Multi-chain
Yes (Base, Solana, fiat)
Lightning only
Challenge
PAYMENT-REQUIRED
WWW-Authenticate: L402
Payment header
X-PAYMENT
Authorization: L402
Backed by
Coinbase, Cloudflare, Google, Visa
Lightning Labs
Since
May 2025
March 2020
HTTP 402 Payment Required has been "reserved for future use" since 1997. Two protocols now claim that future. They've made opposite bets on whether payments need an intermediary.
x402 requires a Facilitator—Coinbase's infrastructure—to verify signatures and settle funds on-chain. The agent never touches gas and gets dollar-stable pricing. If the Facilitator rejects the request or goes down, the payment doesn't complete.
L402 has no intermediary. Agent pays a Lightning invoice, server verifies a hash locally, resource delivered. Zero steps require anyone's permission. You run Lightning infrastructure, price in volatile sats, and channel liquidity is your problem.
An AI agent making thousands of API calls a day will eventually need to pay for one. Whether it can depends on who else has to be involved.
Text description of protocol comparison
x402 Protocol (9 steps)
Client sends GET request to Server
Server returns 402 Payment Required with PAYMENT-REQUIRED header containing JSON payment terms
Client signs an EIP-3009 gasless authorization off-chain (no gas, no transaction)
Client retries request with PAYMENT-SIGNATURE header containing the signed proof
Server sends the signed payload to the Facilitator for verification
Facilitator verifies the signature off-chain (~100ms) and confirms
Server delivers the resource (200 OK) — before on-chain settlement
Facilitator submits transferWithAuthorization to settle USDC on Base (~2s)
Blockchain confirms the on-chain settlement
L402 Protocol (5 steps)
Client sends GET request to Server
Server returns 402 with WWW-Authenticate header containing a macaroon and Lightning invoice
Client pays the Lightning invoice with any wallet, receiving the preimage as proof
Client retries request with Authorization header containing the macaroon and preimage
Server verifies locally (SHA256 of preimage matches payment_hash in macaroon) and delivers the resource