⚡ MIT Open Source · TypeScript · Python · Go · Rust · AI-native

The payment layer for
APIs and AI agents.

L402 protocol — machines pay machines. Bring your Lightning node or ours. No middleman required.

Sovereign
BTCPay · Alby Hub · LNbits
0% fee · your node · your keys
Plug & Play
Hosted Lightning endpoint
0.3% · no node needed
AI Agents
L402Client · autonomous pay
Claude · GPT · any agent
Read the docs →
Or scaffold a full server in one command:
4
Languages
<1s
Settlement
0%
Fee (own wallet)
1 sat
min. price
Without l402-kit
Stripe minimum: $0.30 per call
Requires account signup — friction
AI agents can't pay autonomously
~60 countries blocked by processors
2–7 day settlement window
With l402-kit ⚡
1 sat minimum ≈ $0.0006 per call
No account — any Lightning wallet pays
AI agents pay natively, autonomously
0 countries blocked — global by default
<1 second settlement, final
Live
BTC / USD
1 sat
current value
100 sats
~1 API call
1,000 sats
~10 calls
0.01 BTC
1,000,000 sats
▶ Interactive Demo

The full L402 flow, live

Real HTTP headers. Real Lightning invoice. Watch request → 402 → pay → 200.

l402-kit · HTTP 402 Payment Required
$

Click ▶ Run to simulate  ·  Try with a real Lightning wallet →

⚡ AI Agent
TypeScript
Python
Go
Rust
// npm install l402-kit  — AI agent consuming an L402-protected API
import { L402Client } from "l402-kit";
import { AlbyProvider } from "l402-kit";

// Agent has its own Lightning wallet — pays autonomously
const client = new L402Client({
  wallet: new AlbyProvider(process.env.ALBY_TOKEN!, process.env.ALBY_URL!),
});

// Automatic: 402 detected → pays invoice → retries → returns data
const res = await client.fetch("https://any-l402-api.com/data");
const data = await res.json();
// → 200 OK — paid in <1s, no human involved, no API key, no subscription
// npm install l402-kit  — protect your API (sovereign, 0% fee)
import express from "express";
import { l402, AlbyProvider } from "l402-kit";

const app = express();
const lightning = new AlbyProvider(
  process.env.ALBY_TOKEN!,   // hub.getalby.com — self-custodial
  process.env.ALBY_URL!
);

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

app.listen(3000);
// 0% fee. Your node. Every sat goes directly to you.
# pip install l402kit  — protect your FastAPI endpoint (sovereign)
from fastapi import FastAPI
from l402kit import l402_required, BlinkProvider

app = FastAPI()
lightning = BlinkProvider(
    api_key="your_blink_key",    # dashboard.blink.sv — free
    wallet_id="your_wallet_id"
)

@app.get("/premium")
@l402_required(price_sats=100, lightning=lightning)
async def premium():
    return {"data": "Payment confirmed ⚡"}
// go get github.com/shinydapps/l402-kit/go
package main

import (
    "fmt"; "net/http"
    l402kit "github.com/shinydapps/l402-kit/go"
)

func main() {
    http.Handle("/premium", l402kit.Middleware(l402kit.Options{
        PriceSats: 100,
        Provider:  l402kit.NewBlinkProvider(os.Getenv("BLINK_KEY"), os.Getenv("BLINK_WALLET")),
    }, http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
        fmt.Fprintln(w, `{"data":"Payment confirmed ⚡"}`)
    })))
    http.ListenAndServe(":8080", nil)
}
// Cargo.toml: l402kit = "0.1"
use axum::{middleware, routing::get, Router};
use l402kit::{l402_middleware, Options};
use std::sync::Arc;

async fn handler() -> &'static str {
    "{\"data\":\"Payment confirmed ⚡\"}"
}

#[tokio::main]
async fn main() {
    let opts = Arc::new(
        Options::new(100).with_address("you@yourdomain.com"),
    );
    let app = Router::new()
        .route("/premium", get(handler))
        .route_layer(middleware::from_fn_with_state(opts, l402_middleware));
    let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}
MIT
Open source license
GitHub Stars
npm downloads
PyPI downloads
<1s
Settlement
0
Countries blocked

How it works

📡
Client calls API
GET /premium
402 + Invoice
BOLT11 Lightning invoice returned
💸
Client pays
Any Lightning wallet, <1 second
🔐
Proof verified
Verified in <1ms — no DB, pure crypto
200 OK + data
You get 99.7% of every sat

Why credit cards fail for APIs

Stripe was built for humans buying products. APIs charge per-call — and that breaks everything.

💸
$0.30 minimum fee
A 1-cent API call costs $0.30 in card fees. You lose money on every request under that threshold.
🤖
AI agents can't hold cards
Autonomous agents have no billing address, no CVV, no human to click "confirm". Card payment fails.
↩️
APIs can't be "returned"
You already delivered the data. A chargeback lets the caller take it for free — and you pay the fee.
🌍
50+ countries blocked
Stripe and PayPal don't operate everywhere. Your API is global — your payment processor shouldn't decide who gets in.

Why not legacy payments?

Card processorsPayPal / legacyl402-kit ⚡
Minimum fee$0.30$0.30< 1 sat
Settlement2–7 days3–5 days< 1 second
ChargebacksYesYesImpossible
Requires accountYesYesNo
AI agent nativeNoNoYes
Countries blocked~50~600 — global
Open sourceNoNo100%

Why developers ⚡ l402-kit

Plug and play
Add your Lightning Address and go. Or connect your own wallet for zero fee. Your choice.
🌍
4 languages
TypeScript, Python, Go, Rust. Express, FastAPI, Flask, Axum. Same protocol, any stack.
🤖
AI agent native
Machines can pay machines. No human in the loop. Perfect for autonomous AI agents.
🔐
Cryptographic proof
SHA256(preimage) === token.hash — verified in <1ms locally. No DB, no network. Chargebacks are impossible.
📊
Payment logging
Every payment logged to Supabase automatically. See who paid, when, and how much.
🧩
Bring your wallet
Blink, OpenNode, LNbits, BTCPay — or any wallet. Swap providers in one line. Zero lock-in.

Who is this for?

You own the API. You keep 99.7% of every sat.

🛠️
API Owner
You sell data or compute
You built an API — weather, AI inference, market data, media — and want to monetize it per call without Stripe, subscriptions, or billing dashboards.
  • Add 3 lines of middleware
  • Set your price in sats
  • Receive Bitcoin instantly
🤖
AI Builder
Your agent needs to pay for tools
You're building autonomous AI agents that call external APIs. L402 is the native payment protocol for agents — no OAuth, no card on file, no human approval loop.
  • Agent gets 402 → pays invoice
  • Retries with proof → gets data
  • Works with any LLM framework
📦
OSS Developer
You want sustainable open source
Your library or tool is free and open source, but you want paid tiers — premium endpoints, higher rate limits — without the overhead of a payment SaaS.
  • Free endpoints stay free
  • Paid tiers in 10 minutes
  • No Stripe account needed

What will you build?

AI / Agents
Monetize your AI tool
Charge per inference call. LLM wrappers, image gen, OCR APIs. Works natively with LangChain and AutoGPT agents.
priceSats: 50 // ~$0.05/call
Data APIs
Pay-per-query data
Weather, finance, sports, maps. No subscription needed — users pay exactly for what they use.
priceSats: 10 // ~$0.01/query
Content
Paywalled endpoints
Articles, research papers, PDFs, audio. No account creation required from your users.
priceSats: 500 // ~$0.50/read
Compute
Serverless billing
Charge for CPU-heavy tasks: rendering, transcription, compression. Pure usage-based, no monthly fee.
priceSats: 1000 // ~$1/task
Editor Extension

Track your Lightning payments — right in your editor

See every payment in real time, with live charts and instant notifications. No setup, no account, no permissions required. Works with TypeScript, Python, Go, Rust and more.

  • Real-time payment feed
  • Bar chart — 1D / 7D (free) · 30D / 1Y / ALL (Pro)
  • Multi-language support
  • Light & dark mode
  • No account or permissions needed
Install Free on Marketplace Documentation →
Lang English (EN)
BTC $ · 1 sat = $—
⚡ ShinyDapps Payments
Total Payments
Total Sats
LIGHTNING ADDRESS
you@yourdomain.com
⚡ ShinyDapps Pro
Full history · CSV · Pay in Bitcoin
~9k sats/mo

Simple pricing

Pay with Bitcoin Lightning. No credit card. No account. Instant.

Free
$0 forever
0 sats — always free
0% with your own wallet · 0.3% managed
  • TypeScript, Python, Go, Rust
  • Plug & play or bring your wallet
  • Unlimited API calls
  • Payment history (last 7 days)
  • 1D / 7D charts
  • Open source — self-host anytime
Get started free →
Builder
$99 /month
calculating…
For devs shipping production APIs
  • Everything in Pro
  • Monitor up to 5 Lightning addresses
  • Webhook on every payment received
  • Programmatic API access to your data
  • 0% fee — bring your own provider
Founder
$999 one-time
calculating…
Pay once in Bitcoin. Yours forever.
  • Everything in Builder — forever
  • Early access to DCA agent
  • Listed as founding supporter
  • Input on the roadmap
  • No renewal. Ever.

No card. No account. Pay with Bitcoin · Cancel anytime · Your data, your control — delete anytime ↗

Trusted by developers building on Bitcoin

"Finally, a payments lib that treats Bitcoin as first-class. 3 lines and it just works."

A
Early adopter
API developer

"My AI agent now pays for its own API calls. No wallets, no keys, no human approval."

B
AI engineer
LLM tooling

Open source · MIT · Star on GitHub ⭐

Common questions

Does my API require users to have a Lightning wallet?
Yes — they need a Lightning wallet to pay. Apps like Strike, Cash App, Blink, and Phoenix take under 60 seconds to set up. For AI agents, they hold their own wallet programmatically.
What happens if the Lightning network is down?
Lightning is a decentralized network with near-100% uptime. If your provider (Blink, OpenNode, etc.) has downtime, you can swap to another in one line of code.
Is this production-ready?
Yes. Cryptographic proof (SHA256), replay-attack protection, and Supabase payment logging are built in. See the security guide in the docs.
How does the 0.3% fee work?
If you use our managed infrastructure (just add your Lightning address, we handle the rest), we keep 0.3%. If you connect your own wallet — Blink, OpenNode, LNbits, BTCPay — the fee is zero. You can switch at any time with one line of code.
Can I use it without Blink?
Yes. OpenNode, LNbits, BTCPay, Alby — or any provider implementing the LightningProvider interface. You can use your own Lightning node. Blink is never required.
Why Lightning and not on-chain Bitcoin?
On-chain Bitcoin takes 10+ minutes to confirm and costs $1–5 per transaction. Lightning settles in under a second for fractions of a cent — making $0.001 micropayments economically viable. If you bring your own wallet, your keys never leave your control. The payment proof (SHA256 preimage) is verified locally on your server — no third party involved.
How is this different from Coinbase's x402?
x402 is a protocol specification — it defines how HTTP 402 payments should work. l402-kit is a production-ready SDK that implements that same standard today, in TypeScript, Python, Go, and Rust. Coinbase's x402 targets USDC and stablecoins. l402-kit targets Bitcoin Lightning. They're complementary, not competing — and we're shipping code while they're publishing specs.
Is the 0.3% fee always charged?
No. The fee only applies if you use our managed infrastructure (add your Lightning address, we handle invoice creation). If you connect your own wallet — Blink account, OpenNode, LNbits, BTCPay, any provider — the fee is zero. You can switch at any time with one line of code. The open-source MIT license means you can self-host everything with no fees ever.

Start in 2 minutes ⚡

No account. No credit card. Just Bitcoin Lightning.

npm install l402-kit pip install l402kit Go SDK → cargo add l402kit

or read the docs →

Privacy-first architecture

Your wallet is your identity.
Nothing else required.

Most payment APIs need your email, credit card, and account. l402-kit needs none of that — your Lightning wallet is cryptographic proof of who you are.

🔑

No account. No password.

Your Lightning Address is your identity. Authentication is a secp256k1 signature from your wallet — mathematically unforgeable, no server involved.

🗄️

Zero PII stored.

No email. No name. No IP. We store payment_hash — already public in the BOLT11 invoice. A database breach exposes nothing personal.

🔐

Keys never centralized.

Payment logic runs inside the database (Supabase Edge Functions). The API server holds only the invoice key — not your data, not your identity, not your history.

🗑️

Delete with cryptographic proof.

Only your wallet can authorize deletion of your data. No support ticket. No email verification. Sign the challenge — data is gone. Single-use token prevents replay.

💸

Payments are private by default.

Lightning payments don't identify the payer on-chain. The preimage is never stored. Your users pay anonymously — you just know the invoice was settled.

📊

Dashboard auth by wallet, not password.

Your analytics dashboard authenticates via LNURL-auth — the same secp256k1 flow. No password to phish, no session to hijack, no Vercel holding your admin secret.

vs. Stripe / LemonSqueezy / Paddle
They require email, KYC, account creation, and centralize all keys. A single breach exposes every customer's identity and payment history.
No email collected
No account required
No KYC, no compliance overhead
Cryptographic delete (LNURL-auth)
LGPD/GDPR compliant by design

Stay in the loop

Follow releases on GitHub — star the repo and enable notifications. No email required, no account, no tracking.

⭐ Star on GitHub

No email · No tracking · Bitcoin-native