x402 vs L402
Both protocols use HTTP status 402 to ask for payment, but they pay differently. L402, from Lightning Labs, answers with a Lightning invoice and a macaroon; the client pays in bitcoin over Lightning and then uses the macaroon plus proof of payment as a reusable access token. x402, started by Coinbase, answers with a price in a stablecoin such as USDC, and the client signs a payment for that one request.
The two flows side by side
Shortened, and with header details simplified:
# L402 (Lightning)
GET /data
-> 402 WWW-Authenticate: L402 macaroon="...", invoice="lnbc..."
client pays the invoice over Lightning, receives the preimage
GET /data Authorization: L402 <macaroon>:<preimage>
-> 200 (the same token can be reused while its conditions allow)
# x402 (stablecoin)
POST /api/x402/services/<id>
-> 402 PAYMENT-REQUIRED: base64 JSON {amount, asset, network, payTo, ...}
client wallet signs a transfer authorization for that amount
POST /api/x402/services/<id> PAYMENT-SIGNATURE: <signed payload>
-> 200 PAYMENT-RESPONSE: <transaction id> (next request pays again)
Where they really differ
| L402 | x402 | |
|---|---|---|
| Money | Bitcoin (satoshis) over the Lightning Network | Stablecoins, for example USDC on Base |
| Price stability | Prices in sats move with bitcoin, unless the server reprices | Dollar-pegged, so $0.01 stays $0.01 |
| What the buyer needs | A Lightning wallet or node with funds it can send | A wallet holding the token on the right network |
| After paying | A token (macaroon) that can grant repeated access | One payment per request |
| Settlement | Lightning payment, usually within seconds | On-chain transfer submitted by a facilitator |
| Typical tooling | Lightning Labs' Aperture proxy and Lightning wallets | Coinbase's x402 packages, AgentKit, other x402 clients |
Macaroons: L402's strong point
A macaroon is a token the server can restrict with conditions, called caveats: for example "valid for this endpoint", "until this time" or "for 100 calls". The holder can add more restrictions before passing it on, but can't remove any. That makes L402 good for selling access passes or bundles, not only single calls.
x402 keeps things simpler: every request is its own small payment, and there's no token to store or leak. Which is better depends on whether you sell access or individual results.
How to choose
- Your users already hold bitcoin and Lightning wallets: L402 fits them.
- You want dollar prices and buyers that are agents built with common AI tooling: x402 is the more common choice.
- You sell a pass for many calls: L402's macaroons handle that natively; with x402 you'd price each call.
- You can support both: they don't conflict, since each server decides what its 402 answer offers.
Which one iamai.markets uses
Our pay-per-call APIs use x402 v2 only, in USDC on Base. We don't accept Lightning or L402. Prices start at $0.01 per call, and a call that fails isn't settled, so you're only charged when it works.
Questions
Is L402 the same as LSAT?
L402 is the newer name for what Lightning Labs first called LSAT.
Are both open standards?
Yes. Both are published openly and anyone can build a client or a server.
Can I pay an x402 API with Lightning?
Not unless the server offers it in its 402 answer. Ours offers USDC on Base only.
Related
Updated 2026-12-01