Skip to main content

▶ Watch the 402 flow first

Interactive terminal demo — see request → 402 → Lightning pay → 200 OK, live in your browser.

Option A — Scaffold a full server in one command (fastest)

This creates a complete Express + l402-kit project: server.ts, .env.example, tsconfig.json, and a /premium endpoint ready to accept Lightning payments.
Then:

Option B — Add to an existing project

1. Choose your mode

Not sure? Start with Managed — no node, no account, just a Lightning address. Switch to Soberano in one line of code whenever you want 0% fees. Already-paid tokens keep working after the switch. Get a Lightning address (free, 2 min): Sign up at dashboard.blink.sv — you’ll receive yourname@blink.sv. Or use Alby, Phoenix, or Wallet of Satoshi. Soberano setup: Sign up at dashboard.blink.svAPI Keys → create key → copy your BTC Wallet ID from the wallet page. Set BLINK_API_KEY and BLINK_WALLET_ID in your .env.

2. Install

3. Add to your API

4. Test it

Response:
Pay the invoice with any Lightning wallet, then:
Response:
Your API now accepts Bitcoin payments.

Test without real sats

You don’t need a Lightning wallet to test your integration. Use a mock provider — it generates valid cryptographic token pairs locally, zero network calls:
For real-money testing with the sandbox, use OpenNode’s testMode:
Full testing guide → Testing