L402

L402 is an HTTP payment scheme that pairs a bearer token with a Lightning invoice. A server answers an unpaid request with HTTP 402 and a WWW-Authenticate header carrying both; the client pays the invoice and presents the token together with the payment preimage as proof.

The specification defines the credential as a macaroon and preimage pair carried in the Authorization header — the bearer token, and the proof the paid invoice yields. The challenge is a WWW-Authenticate: L402 header returned alongside HTTP 402, containing a macaroon and a Lightning invoice. The macaroon commits to the invoice by carrying that invoice's payment hash.

The commitment is what makes checking stateless. A server can confirm payment by checking the token against the preimage presented with it, without consulting a payment database. Whoever holds a macaroon can also narrow it and pass it on, which is how one credential gets split across several callers with narrower permissions.

Set beside the other rails it is a sibling rather than a rival reading. L402 and MPP both put their challenge in the WWW-Authenticate field HTTP already defines for authentication challenges, where x402's current transport defines headers of its own. Its documentation describes the standard as one for authenticating and trading services such as API endpoints and computational resources.

→ probe402 records which rail each tracked endpoint answers on alongside every reading — the tracked set is at the endpoint list.

Sources

Related payment challenge · HTTP 402 · MPP · x402

Glossary