Machine Payment Protocol (MPP) Explained: How HTTP 402 Became a Real Standard
For 30 years, HTTP 402 "Payment Required" sat in the spec as "reserved for future use." In March 2026, Stripe and Tempo turned it into a working protocol for machine-to-machine payments. Here's what MPP is, how it compares to L402, and why it matters for AI agents that need to pay for tools autonomously.
The 30-Year Wait for HTTP 402
HTTP has status codes for everything: 200 OK, 401 Unauthorized, 403 Forbidden, 404 Not Found. But 402 — "Payment Required" — was defined in the original HTTP spec in 1997 and immediately shelved. The web had no native payment layer, so the code sat unused for three decades.
The Lightning Network changed that. Lightning enables instant, programmable micropayments over Bitcoin — exactly the kind of payment layer HTTP 402 was waiting for. Lightning Labs built L402 (formerly LSAT) in 2020, combining Lightning invoices with macaroon-based auth tokens to make 402 responses functional. Agents hit an endpoint, got a 402 with an invoice, paid it, and retried with proof.
L402 proved the model works. But it was a Lightning-ecosystem protocol without formal standardization. On March 18, 2026, Stripe and Tempo co-published the Machine Payment Protocol — an IETF draft (draft-ryan-httpauth-payment) that formalizes HTTP 402 as a standard for machine-to-machine payments. MPP doesn't replace L402 — it's a parallel standard with broader industry backing.
How MPP Works
The flow is the same as L402 at a high level: request, get a price, pay, prove payment. The differences are in the header formats and credential encoding.
Client sends a request
The agent or client sends a normal HTTP request to the API endpoint. No special headers needed for the initial request.
Server responds with 402 + payment challenge
The server returns HTTP 402 with a WWW-Authenticate header containing the payment challenge. This includes the Lightning invoice, a charge ID, expiry time, and the payment method.
Client pays the Lightning invoice
The agent pays the Lightning invoice using any Lightning wallet. Payment settles in milliseconds and yields a preimage — cryptographic proof of payment.
Client retries with payment proof
The client resends the original request with an Authorization header containing the payment credential. The server verifies the preimage, serves the response, and includes a Payment-Receipt header as confirmation.
MPP vs. L402: What's Different
Both protocols solve the same problem — pay-per-request API access via HTTP 402. The differences are in the wire format, not the concept.
| MPP | L402 | |
|---|---|---|
| Auth scheme | Payment | L402 |
| Credential format | Base64url JSON | macaroon:preimage |
| Spec | IETF draft | Lightning Labs |
| Backers | Stripe, Tempo | Lightning Labs, LN ecosystem |
| Success header | Payment-Receipt | None (implicit) |
| Payment rail | Payment-method agnostic (Lightning, fiat, stablecoins) | Lightning native |
Key distinction: MPP is payment-method agnostic by design — the spec supports Lightning, fiat, and stablecoins. Stripe's implementation defaults to fiat. Sats4AI's implementation is Lightning-native: self-custodial, private, and instant. Same protocol, different rails.
What the Headers Look Like
Sats4AI returns both challenges in a single WWW-Authenticate header. Clients pick the scheme they support.
402 Response (dual challenge)
HTTP/1.1 402 Payment Required
Cache-Control: no-store
WWW-Authenticate:
L402 token="<macaroon>", macaroon="<macaroon>", invoice="lnbc...",
Payment id="<charge-id>", realm="sats4ai.com",
method="lightning", intent="charge",
request="<base64url-json>", expires="<iso-timestamp>"Option A: L402 authorization
POST /api/l402/generate-image HTTP/1.1
Authorization: L402 <base64-macaroon>:<hex-preimage>
Content-Type: application/json
{"input":{"prompt":"A neon-lit Tokyo alley at midnight"}}Option B: MPP authorization
POST /api/l402/generate-image HTTP/1.1
Authorization: Payment eyJjaGFsbGVuZ2UiOnsiaWQiOiIxMjM0NSIs
Im1hY2Fyb29uIjoiPGJhc2U2ND4ifSwicGF5bG9hZCI6eyJwcmVpbW
FnZSI6IjxoZXg-In19
Content-Type: application/json
{"input":{"prompt":"A neon-lit Tokyo alley at midnight"}}
# The base64url decodes to:
# {
# "challenge": { "id": "12345", "macaroon": "<base64>" },
# "payload": { "preimage": "<hex>" }
# }Success response (with receipt)
HTTP/1.1 200 OK
Payment-Receipt: eyJzdGF0dXMiOiJzdWNjZXNzIiwibWV0aG9kIjoi
bGlnaHRuaW5nIiwidGltZXN0YW1wIjoiMjAyNi0wMy0yMFQxMjowMDo
wMFoiLCJyZWZlcmVuY2UiOiJjaGFyZ2U6MTIzNDUifQ
Content-Type: application/json
{"imageUrl":"https://..."}
# Payment-Receipt decodes to:
# {
# "status": "success",
# "method": "lightning",
# "timestamp": "2026-03-20T12:00:00Z",
# "reference": "charge:12345"
# }Why This Matters for AI Agents
Payment becomes native HTTP
An agent doesn't need a Stripe account, API key, or billing dashboard. It sends a request, gets a price in the 402 response, pays, and moves on. Payment is part of the protocol, not a side channel.
No signup, no identity
Traditional APIs require registration, email verification, credit cards, and often KYC. With 402-based protocols, the payment itself is the authentication. An agent with a Lightning wallet can use any 402 API immediately.
Interoperability is coming
With Stripe backing MPP and Lightning Labs backing L402, two major ecosystems are converging on 402 as the machine payment standard. Agents that speak 402 can use APIs across both ecosystems without protocol-specific integrations.
Verifiable receipts
MPP's Payment-Receipt header gives agents cryptographic proof of payment for every API call. This enables audit trails, expense tracking, and trust scoring without centralized billing systems.
Two Flavors of MPP
MPP is payment-method agnostic. The protocol defines the HTTP flow; the payment rail is pluggable. In practice, two distinct implementations are emerging:
Fiat MPP (Stripe)
- Payment via Stripe-issued credentials
- USD-denominated, enterprise-focused
- Agent needs a Stripe-connected wallet or account
- Subject to standard financial compliance
- Settlement in days (bank rails)
Lightning MPP (Sats4AI)
- Payment via Lightning invoice
- Sats-denominated, privacy-first
- Agent needs only a Lightning wallet
- No identity, no account, no KYC
- Settlement in milliseconds
These serve different audiences. Enterprise agents that need USD stability and corporate billing use Stripe's implementation. Agents that need privacy, instant settlement, and micropayment granularity use Lightning-native implementations. Sats4AI is Lightning-native — self-custodial, private, and settling in milliseconds.
What This Means for the Ecosystem
HTTP 402 is no longer experimental
Stripe putting its name on an HTTP 402 protocol means every web framework, API gateway, and CDN provider will take it seriously. L402 proved the concept; MPP makes it an industry standard. APIs that accept 402 payments will become normal, not niche.
The barrier to competition drops
When adding a paywall to a Cloudflare Worker is "one line of code," more APIs will gate content behind 402. The moat isn't the payment protocol anymore — it's the services behind it. Infrastructure that can't be replicated (phone calls, SMS, specialized AI models, e-signatures) matters more than ever.
Lightning's privacy advantage holds
Fiat MPP requires identity somewhere in the chain — Stripe needs to know who's paying. Lightning MPP requires nothing: an anonymous wallet pays an anonymous invoice. For agents in restricted regions, privacy-sensitive applications, or situations where identity is a liability, Lightning remains the only viable rail.
Try It: Dual-Protocol in Action
Every Sats4AI endpoint accepts both L402 and MPP authorization. Here's a complete flow using curl and lnget.
# Step 1: Hit the endpoint, get a 402 with dual challenges
curl -s -o /dev/null -w "%{http_code}" \
-X POST https://sats4ai.com/api/l402/translate-text \
-H "Content-Type: application/json" \
-d '{"input":{"text":"Hello world","targetLang":"es"}}'
# Returns: 402
# Step 2: Get the full 402 response with challenges
curl -s -D - -X POST https://sats4ai.com/api/l402/translate-text \
-H "Content-Type: application/json" \
-d '{"input":{"text":"Hello world","targetLang":"es"}}'
# WWW-Authenticate: L402 token="...", Payment id="..."
# Step 3a: Pay with lnget (auto-pays Lightning invoices)
lnget POST https://sats4ai.com/api/l402/translate-text \
-d '{"input":{"text":"Hello world","targetLang":"es"}}'
# Step 3b: Or via MCP (payment handled by the MCP client)
curl -X POST https://sats4ai.com/api/mcp \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/call",
"params":{"name":"translate",
"arguments":{"paymentId":"<id>",
"text":"Hello world",
"targetLang":"es"}}}'Protocol Discovery
Agents and directory crawlers can check which protocols an endpoint supports before making requests.
# Check supported protocols
curl -s https://sats4ai.com/.well-known/l402-services | jq '.authentication'
# {
# "protocols_supported": ["L402", "MPP"],
# "mpp": {
# "spec": "IETF draft-ryan-httpauth-payment",
# "challenge_format": "Payment id=\"...\", realm=\"sats4ai.com\", ..."
# }
# }
# Or via the MCP manifest
curl -s https://sats4ai.com/.well-known/mcp | jq '.protocols'
# ["L402", "MPP"]All 19 L402 endpoints also advertise MPP support in their GET response metadata.
FAQ
Do I need to choose between L402 and MPP?
No. Sats4AI accepts both. Use whichever your client supports. If your agent uses lnget or an L402 library, use L402. If it uses an MPP-native SDK, use Payment. Both work on every endpoint.
Is MPP only for Lightning payments?
The protocol is payment-method agnostic — Stripe's implementation uses fiat. Sats4AI's implementation uses Lightning exclusively. The protocol is the same; the payment rail differs.
Will L402 be deprecated?
No. L402 has a large installed base (100+ live services, lnget, Aperture, Lightning Labs tools). MPP is a parallel standard, not a replacement. Both will coexist.
What is the Payment-Receipt header?
An MPP-specific response header that provides a base64url-encoded JSON receipt after successful payment. Contains status, payment method, timestamp, and a charge reference. Useful for audit trails and automated expense tracking.
Does 402index.io list both protocols?
Yes. Sats4AI's endpoints are registered on 402index.io with both L402 and MPP protocol support listed. The directory is the primary registry for 402-gated APIs.
Related
How agents discover Sats4AI tools via MCP and authenticate with Lightning payments.
Connect Claude, Cursor, or any MCP-compatible agent to 25+ AI tools.
25+ AI Tools — L402 and MPP, Zero Signup
Every endpoint speaks both protocols. Your agent picks the one it supports. Payment is the only credential.