Installation
Cargo.toml:
Quickstart
The fastest path usesManagedProvider — no Lightning node needed, 0.3% fee:
LightningProvider trait — see Custom provider below.
Custom provider
Options
Deprecated: with_address()
Options::with_address(address) was removed in v1.4.0. Use Options::new(sats, ManagedProvider::new(address)) instead:
l402_middleware(opts: Options)
Returns an axum::middleware::Layer compatible with axum 0.8+.
Behavior
402 response body
on_payment callback
Feature flags
axum-middleware to use only the core verification functions without axum or reqwest:
Verification
SHA256(preimage) == paymentHash is verified locally using the sha2 crate — no network call on the hot path. Token expiry is checked in the same operation.