Skip to main content

Two modes

ModeProviderFeeTestnet / SandboxSetup
ManagedManagedProvider0.3% per sat❌ (use mock in tests)Lightning address only
SoberanoBlink0%❌ mainnet onlyFree custodial account
SoberanoLNbits0%✅ RegTest / signetSelf-host or public instance
SoberanoOpenNode0%testMode: trueFree sandbox account
SoberanoAlby Hub0%✅ via Hub testnet walletSelf-custodial cloud node
SoberanoBTCPay0%✅ RegTest supportSelf-hosted node
SoberanoCustom0%✅ whatever you wire upAny Lightning backend
Managed mode — l402kit.com hosts the Lightning node. You add your Lightning address. We forward 99.7% of every sat to you automatically. Soberano mode — You connect your own Lightning wallet/node. 0% fee, full custody, works with any provider.
No Lightning node needed. Add your Lightning address and start earning — l402kit.com handles all invoice creation and payment routing. Fee: 0.3% per sat received. 99.7% lands directly in your Lightning wallet. No monthly fee.
import { l402, ManagedProvider } from 'l402-kit';
import express from 'express';

const app = express();
const lightning = ManagedProvider.fromAddress('you@yourdomain.com');

app.get('/premium', l402({ priceSats: 10, lightning }), (req, res) => {
  res.json({ data: 'Payment confirmed ⚡' });
});

app.listen(3000);
// 0.3% fee · no node setup · works immediately
How it works:
  1. Your API calls ManagedProvider.fromAddress("you@domain.com")
  2. When a caller hits your endpoint, l402kit.com creates a Lightning invoice
  3. Caller pays → Lightning settles → 99.7% forwarded to your Lightning address instantly
  4. Your API verifies the cryptographic proof and returns 200 OK
The 0.3% routing fee is the only cost. No monthly fee. No account registration. Any Lightning address works (Blink, Phoenix, Alby, Strike, Wallet of Satoshi, etc.).

Trust & availability

Who runs l402kit.com? ShinyDapps (open source, MIT). The managed infrastructure runs on Cloudflare Workers — globally distributed, no single server to go down. Uptime: Monitored 24/7 at stats.uptimerobot.com/57uOzF17jK. SLA target: 99.9%. What if l402kit.com disappears? Your verification logic is local — SHA256(preimage) == paymentHash runs in your process, zero network calls. Only invoice creation touches l402kit.com. If the managed service goes down, switch to any soberano provider in one line:
// Before (managed)
const lightning = ManagedProvider.fromAddress("you@yourdomain.com");

// After (soberano — 0% fee, full custody)
const lightning = new BlinkProvider(process.env.BLINK_API_KEY!, process.env.BLINK_WALLET_ID!);
No other code changes. Already-paid tokens keep working — verification is purely cryptographic. Can I self-host the managed layer? Yes. The full source is on GitHub under MIT. cloudflare/ contains the managed API worker — deploy it to your own Cloudflare account in 5 minutes.
Blink is a free custodial Bitcoin Lightning wallet with a GraphQL API. No KYC, no monthly fee, instant setup. Use it to run in soberano mode with 0% fee.
Contingency plan: Blink is a free service — their pricing can change. If Blink adds fees or limits the API, switch to another soberano provider in one line of code (no other changes required, already-paid tokens keep working). Zero lock-in. Good alternatives: LNbits (self-hosted, 0% forever), OpenNode (commercial SLA), Alby Hub (self-custodial), or BTCPay (fully sovereign).
Get started:
  1. Create account at dashboard.blink.sv
  2. Go to API Keys → create a new key
  3. Copy your BTC Wallet ID from the wallet page
import { BlinkProvider } from 'l402-kit';

const blink = new BlinkProvider(
  process.env.BLINK_API_KEY!,    // blink_xxx...
  process.env.BLINK_WALLET_ID!,  // UUID
);
Environment variables:
BLINK_API_KEY=blink_xxxxxxxxxxxxxxxxxxxxxxxx
BLINK_WALLET_ID=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx

LNbits (Soberano — 0% fee)

LNbits is an open-source Lightning wallet server. Self-host it or use a public instance. Get started:
  1. Set up LNbits (self-host or use legend.lnbits.com)
  2. Create a wallet → copy the Invoice/read key
import { LNbitsProvider } from 'l402-kit';

const lnbits = new LNbitsProvider(
  process.env.LNBITS_KEY!,
  process.env.LNBITS_URL ?? 'https://legend.lnbits.com',
);
Environment variables:
LNBITS_KEY=your-invoice-read-key
LNBITS_URL=https://your-lnbits-instance.com

OpenNode (Soberano — 0% fee)

OpenNode is a Lightning provider with a free sandbox for testing. Get started:
  1. Create account at app.opennode.com
  2. Go to IntegrationsAPI Keys → create a key
import { OpenNodeProvider } from 'l402-kit';

const opennode = new OpenNodeProvider(
  process.env.OPENNODE_KEY!,
  process.env.NODE_ENV !== 'production', // testMode
);

Alby Hub (Soberano — 0% fee)

Alby Hub is a self-custodial Lightning node in the cloud. Your keys, your sats — no custodian. Get started:
  1. Create a Hub at hub.getalby.com (or self-host)
  2. Go to Settings → Access Tokens → create token with invoices:create + invoices:read scopes
  3. Copy your Hub URL and access token
import { AlbyProvider } from 'l402-kit';

const alby = new AlbyProvider(
  process.env.ALBY_ACCESS_TOKEN!,  // Hub → Settings → Access Tokens
  process.env.ALBY_HUB_URL!,       // e.g. "https://your-name.getalby.com"
);
Environment variables:
ALBY_ACCESS_TOKEN=your-alby-access-token
ALBY_HUB_URL=https://your-name.getalby.com

BTCPay Server (Soberano — 0% fee)

BTCPay Server is fully self-sovereign Bitcoin + Lightning. Your node, your keys, zero custody. Compatible with: self-hosted (Umbrel, Start9, VPS) or managed (Voltage, LunaNode). Get started:
  1. BTCPay store → Lightning → Settings
  2. Account → API Keys → generate key with scope btcpay.store.cancreatelightninginvoice
  3. Copy your Store ID from the store URL
import { BTCPayProvider } from 'l402-kit';

const btcpay = new BTCPayProvider(
  process.env.BTCPAY_URL!,       // e.g. "https://btcpay.yourdomain.com"
  process.env.BTCPAY_API_KEY!,   // Account → API Keys
  process.env.BTCPAY_STORE_ID!,  // from store URL
);
Environment variables:
BTCPAY_URL=https://btcpay.yourdomain.com
BTCPAY_API_KEY=your-api-key
BTCPAY_STORE_ID=your-store-id

Custom provider (Soberano — 0% fee)

Implement the LightningProvider interface to use any Lightning backend:
import type { LightningProvider, Invoice } from 'l402-kit';

class MyProvider implements LightningProvider {
  async createInvoice(amountSats: number): Promise<Invoice> {
    // Call your Lightning node API
    const result = await myNode.createInvoice(amountSats);
    const macaroon = Buffer.from(
      JSON.stringify({ hash: result.hash, exp: Date.now() + 3_600_000 })
    ).toString('base64');
    return {
      paymentRequest: result.bolt11,
      paymentHash: result.hash,
      macaroon,
      amountSats,
      expiresAt: Date.now() + 3_600_000,
    };
  }

  async checkPayment(paymentHash: string): Promise<boolean> {
    return myNode.isPaid(paymentHash);
  }
}