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.

Read the docs

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

L402x402
MoneyBitcoin (satoshis) over the Lightning NetworkStablecoins, for example USDC on Base
Price stabilityPrices in sats move with bitcoin, unless the server repricesDollar-pegged, so $0.01 stays $0.01
What the buyer needsA Lightning wallet or node with funds it can sendA wallet holding the token on the right network
After payingA token (macaroon) that can grant repeated accessOne payment per request
SettlementLightning payment, usually within secondsOn-chain transfer submitted by a facilitator
Typical toolingLightning Labs' Aperture proxy and Lightning walletsCoinbase'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

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