3 linhas de código. Sem Stripe. Sem cadastro. Agentes de IA pagam nativo — máquinas pagam máquinas.
Watch the full L402 flow: request → 402 → pay → 200.
// 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.
// npm install l402-kit — managed mode: no node, no wallet setup import express from "express"; import { l402, ManagedProvider } from "l402-kit"; const app = express(); // l402kit.com hosts the Lightning node — no setup needed const lightning = ManagedProvider.fromAddress("you@yourdomain.com"); // ↑ payments go directly to your Lightning address (99.7% of each sat) app.get("/api/data", l402({ priceSats: 10, lightning }), (req, res) => { res.json({ data: "Payment confirmed ⚡" }); }); app.listen(3000); // Fee: 0.3% to l402kit.com · 99.7% to you · TypeScript only
# 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(); }
Click ▶ Run to simulate · Open live L402 endpoint →
This button creates a real BOLT11 invoice via ManagedProvider (0.3% fee to l402kit.com, 99.7% to shinydapps@blink.sv). Pay from any Lightning wallet — this is l402-kit eating its own cooking.
⚡ Support this project1 sat · ~$0.001 · instant · no account
Stripe foi construído para humanos comprando produtos. APIs cobram por chamada — e isso quebra tudo.
| Processadores de cartao | PayPal / legacy | l402-kit ⚡ | |
|---|---|---|---|
| Minimum fee | $0.30 | $0.30 | < 1 sat |
| Settlement | 2–7 days | 3–5 days | < 1 second |
| Chargebacks | Yes | Yes | Impossible |
| Requires account | Yes | Yes | No |
| AI agent native | No | No | Yes |
| Countries blocked | ~50 | ~60 | 0 — global |
| Open source | No | No | 100% |
You own the API. You keep 99.7% of every sat.
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.
Dashboard de pagamentos Lightning em tempo real dentro do VS Code. Veja cada pagamento no instante em que cai.
Pague com Bitcoin Lightning. Sem cartao. Sem conta. Instantaneo.
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."
"My AI agent now pays for its own API calls. No wallets, no keys, no human approval."
Open source · MIT · Star on GitHub ⭐
Sem conta. Sem cartao. So Bitcoin.
Follow releases on GitHub — star the repo and enable notifications. No email required, no account, no tracking.
⭐ Star on GitHubNo email · No tracking · Bitcoin-native