Skip to main content

What is l402-kit?

l402-kit is an open-source middleware that implements the L402 protocol � the open standard for pay-per-call API monetization using the Bitcoin Lightning Network. Add 3 lines of code. Callers pay in sats. You receive in seconds. Works with TypeScript, Python, Go, and Rust.

? Watch end-to-end demo

See the full L402 flow in action � from npm install to first paid API call. Interactive terminal animation, 45 seconds.

npm

l402-kit on npm

PyPI

l402kit on PyPI

Go

Go SDK (net/http)

Rust

Rust SDK (axum)

llms.txt

For AI agents

Whitepaper

Technical design

Lightning Network — 30-second primer

New to Bitcoin Lightning? Here’s what you need to know:
  • Lightning Network is a fast payment layer on top of Bitcoin. Payments settle in under a second, anywhere in the world, for fractions of a cent.
  • A Lightning Address (like you@blink.sv) is your receive address — it looks like an email. You don’t need to run a node. Wallets like Blink, Alby, and Phoenix give you one for free in 2 minutes.
  • A sat (satoshi) is the smallest unit of Bitcoin — roughly 0.0006at0.0006 at 60k/BTC. A typical API call costs 1–100 sats.
  • Managed vs Soberano — “Managed” means l402kit.com hosts the Lightning node for you (0.3% fee, zero setup). “Soberano” (Spanish for sovereign) means you connect your own wallet (0% fee, ~5 min setup with Blink or Alby).

How it works � full flow

The diagram below shows managed mode (ManagedProvider), where l402kit.com hosts the Lightning node for you. In soberano mode (Blink, Alby, BTCPay, etc.) payments go directly to your wallet � 0% fee.
Full transparency: ShinyDapps receives the payment and forwards 99.7% to your Lightning Address automatically. The 0.3% fee keeps the project alive. The split is deterministic and verifiable � no secrets. For zero-intermediary operation, use soberano mode (Blink, BTCPay, Alby).

Quickstart in 2 minutes

TypeScript

Python

Go

Rust (axum)


Why not Stripe?


Security

Every payment is verified mathematically:
  • Impossible to fake without actually paying
  • Each preimage works exactly once (anti-replay)
  • Tokens expire after 1 hour
  • All logic is deterministic and verifiable � no hidden fees, no intermediaries
  • 600+ automated tests across 5 runtimes � production-grade reliability for autonomous agent workflows

Who is it for?

API developers

Charge per call instead of monthly subscriptions. Start in 1 line.

AI agent builders

Agents pay APIs autonomously � no credit card, no human in the loop.

Devs outside the financial system

Argentina, Nigeria, Iran � Bitcoin has no borders or gatekeepers.

Data providers

Charge 1 sat per query. Impossible with Stripe.

Created by

ShinyDappsgithub.com/ShinyDapps Lightning: shinydapps@blink.sv