x402 vs L402: Two Protocols That Answer HTTP 402
x402 and L402 are the two protocols that take the HTTP 402 status code literally: both use "Payment Required" as the opening move of a real payment handshake rather than an error page, and both are aimed at machine-paid API access. They differ in everything underneath that shared shape — the money they move, the networks they settle on, and the credential the client presents after paying. This page compares them on those mechanics, and on what each one feels like to an agent doing the buying.
What x402 is
x402 is an open payment protocol, originated by Coinbase, that pays for HTTP requests in stablecoins — in practice USDC. A server answers an unpaid request with a 402 response describing its terms as structured data: the amount, the asset, the network, the recipient, and the payment scheme. The client signs a matching payment and retries, and a third-party facilitator verifies the payload and settles the transfer on-chain. Settlement lands on general-purpose blockchain networks; in this directory that means Base, an Ethereum layer-2, and Solana, a high-throughput layer-1.
What L402 is
L402 is a protocol from Lightning Labs that combines the Lightning Network with macaroons for API metering. The Lightning Network is a layer-2 payment network built on Bitcoin, designed for fast, low-fee transfers between payment-channel peers. Macaroons are cryptographic bearer credentials: short, verifiable tokens that can carry fine-grained conditions, called caveats, about what the holder is allowed to do. In L402 the two are fused — paying a Lightning invoice is what mints the credential, so the payment and the access token arrive together.
The flow mirrors x402's shape. A client calls a paid endpoint and receives a 402 response carrying a Lightning invoice and a macaroon. It pays the invoice over Lightning, obtains the cryptographic proof of payment, and retries the request presenting the macaroon plus that proof. The server checks the credential locally and serves the response, and can meter usage by issuing credentials with tighter or looser caveats.
The rails underneath
The biggest practical difference is the money. L402 moves bitcoin over Lightning's channel network; x402 moves dollar-pegged stablecoins on general-purpose chains. That choice cascades into everything else:
- Unit of account. L402 prices are denominated in bitcoin terms; x402 prices are denominated in USDC, so a directory of x402 services can quote stable dollar prices — from $0.00001 up to $10 per request among the listings here.
- Settlement network. Lightning is a purpose-built payment network with no general computation layer; Base and Solana are general smart-contract platforms where USDC transfers are one operation among many.
- Who verifies. x402 introduces the facilitator role — a service that verifies and settles on the server's behalf. L402 verification is self-contained: the server checks the macaroon and payment proof against its own records, with no third party in the loop.
- The credential. x402's credential is the signed payment payload, checked against the server's stated terms. L402's credential is a macaroon, which can be attenuated with caveats — expiry, call counts, endpoint restrictions — making it a metering instrument as well as a receipt.
What each feels like to an agent
From the buyer's side, both protocols are accountless: no signup, no API key, no subscription. An x402 client needs a wallet holding USDC on the chain the server names — which is why the directory's split of 87 Base listings to 13 Solana listings matters when funding an agent. An L402 client needs Lightning capacity and software that can pay invoices and manage macaroons. In both cases the 402 response is self-describing enough for a first-time client to pay without prior contact, which is the property that makes either protocol usable by autonomous software. The history of the 402 status code explains why that machine-readable challenge was the missing piece for decades.
Choosing between them
The choice usually follows the ecosystem rather than the protocol mechanics. Sellers already operating Lightning infrastructure, or selling into bitcoin-native communities, will find L402's combined payment-and-credential design a natural fit — macaroon caveats are genuinely expressive for metering. Sellers who want dollar-stable pricing, smart-contract-chain settlement, and a growing directory of compatible services will find x402's model simpler to price and easier for buyers to budget against, because a USDC price needs no conversion math on either side. Both prove the same thesis: HTTP 402 works once the rail behind it is machine-payable.
Compare live x402 pricing across Base services and Solana services, or browse the full x402 Looker directory.
Frequently asked questions
What is the main difference between x402 and L402?
The rail and the credential. x402 pays in USDC stablecoins on Base or Solana, with a facilitator verifying and settling each payment on-chain; L402 pays in bitcoin over the Lightning Network and uses macaroons, cryptographic bearer credentials, for access and API metering.
Do both protocols use HTTP 402?
Yes. Both answer an unpaid request with a 402 response carrying machine-readable payment terms, and both let a client pay and retry without an account.
Which protocol does this directory track?
x402. All 100 listed services accept per-request USDC payments settling on Base or Solana through one of seven facilitators.
Which is easier for an AI agent to pay with?
Both are accountless. An x402 client needs a wallet holding USDC on the chain the server names; an L402 client needs the ability to pay Lightning invoices and manage macaroon credentials.