Two protocols are competing to become the standard for machine-to-machine payments on the web. Both use HTTP 402 Payment Required. Both let AI agents pay for API access without human intervention. But they work very differently.

L402: Lightning Network Payments

L402 (formerly LSAT) was created by Lightning Labs. When your agent hits an L402-protected endpoint, the server returns a 402 response with a Lightning invoice and a macaroon token. Your agent pays the invoice via Lightning Network, gets a preimage (cryptographic proof of payment), and retries the request with an Authorization header containing the macaroon and preimage.

The payment settles in milliseconds. The cost is typically 1-100 sats per request (fractions of a cent). There are no accounts to create, no API keys to manage. Every request is independently authenticated by the payment itself.

L402 advantages: Sub-second settlement. Micropayments down to 1 sat. No counterparty risk. No KYC. Global. Works over Tor. Battle-tested since 2020.

L402 limitations: Requires Lightning Network access. Payments are in Bitcoin (volatile). Not widely adopted outside the Bitcoin ecosystem.

X402: USDC on Base (Coinbase)

X402 is Coinbase's answer to the same problem. Instead of Lightning, it uses USDC stablecoin on the Base L2 network. When your agent hits an X402 endpoint, the server returns a 402 with payment details including a USDC amount and a recipient address. Your agent signs an EIP-712 authorization and retries with a payment signature header.

X402 advantages: Stable pricing (USD-denominated). Familiar to web3 developers. Backed by Coinbase. Growing DeFi ecosystem integration.

X402 limitations: Slower settlement (L2 block times). Higher minimum practical payment (~$0.01 vs ~$0.0001 for L402). Requires Ethereum wallet infrastructure. USDC is a centralized stablecoin (issuer can freeze funds).

Head-to-Head Comparison

Settlement speed: L402 wins. Lightning is milliseconds. Base L2 is seconds to minutes.

Minimum payment: L402 wins. 1 sat ($0.0007) vs ~$0.01 practical minimum for X402.

Price stability: X402 wins. USDC is pegged to USD. Bitcoin fluctuates.

Decentralization: L402 wins. No issuer can freeze Lightning payments.

Developer adoption: X402 is growing faster in the broader AI ecosystem. L402 has deeper roots in the Bitcoin/Lightning community.

Ecosystem: Both are early. L402 has more production deployments today. X402 has Coinbase's distribution behind it.

Our Approach: Support Both, Prefer L402

The Lightning Wallet MCP server supports both protocols. When your agent calls pay_l402_api, it auto-detects which protocol the server uses from the 402 response headers. If both are available, L402 takes priority (faster, cheaper, more private).

For X402 payments, the server converts the USDC amount to sats at the current market rate, debits your agent's balance, signs the EIP-712 authorization, and completes the request. Your agent always pays in sats regardless of protocol.

The response includes payment_protocol ("l402" or "x402") so your agent knows which was used.

Which Should You Choose?

If you're building agents that need to pay for APIs: use our MCP server and don't worry about it. Protocol detection is automatic.

If you're building an API and want to accept payments: start with L402 if your users are in the Bitcoin ecosystem. Add X402 if you want broader reach. Or use our L402 Gateway to add payments to any existing API without code changes.

If you need stable pricing: X402's USD denomination is simpler for budgeting. But you can achieve the same with L402 by converting at payment time.

If you need true micropayments: L402 is the only option. Paying 1 sat per API call is not practical with any other protocol.

The Bottom Line

Both protocols solve the same problem: letting machines pay for things on the web. L402 is faster, cheaper, and more private. X402 is more stable and has Coinbase behind it. The winning strategy is supporting both, which is exactly what we do.

Get started: npx lightning-wallet-mcp
L402 Gateway: lightningfaucet.com/build/gateway
Docs: lightningfaucet.com/ai-agents/docs