The Friction Nobody Talks About
You're building an AI agent. It needs to call a premium API — weather forecasts, financial data, compute resources, whatever.
How does it pay?
Credit card → requires a human to approve, link a card, and manage billing
API key → requires pre-registration, someone to provision access, a dashboard to manage
OAuth → identity, not payment; you still need billing on top
Every option requires human intervention before the agent can act. That's not autonomous.
HTTP 402: The Protocol That Was Always Meant for This
RFC 2616 reserved status code 402 Payment Required back in 1999 — "for future use." That future is now, and it's called the L402 protocol .
Here's what it looks like from the agent's perspective:
Agent → GET /api/premium-data Server ← 402 Payment Required WWW-Authenticate: L402 invoice="lnbc10n1..."
Agent pays Lightning invoice (1 sat, ~$0.001) Agent → GET /api/premium-data Authorization: L402 <macaroon>:<preimage> Server verifies: SHA256(preimage) == paymentHash ✓…