A paid API needs to connect a payment to the access it buys. L402 gives clients a Lightning invoice and an access token, then lets them authenticate with that token and proof of payment.
A practical approach
Put an L402 payment gate in front of your API using middleware with a Phoenixd backend. Choose whether a payment buys a request, prepaid usage, or access for a fixed period.
Set your price and access policy. Decide which endpoints are paid, what they cost in sats, and how much access a payment unlocks.
Connect your Phoenixd node. Use a Phoenixd-compatible payment gate to create invoices and issue access tokens for your API.
Serve authenticated requests. Let clients pay the invoice and present their token with proof of payment. Enforce the purchased access before returning your result.
Your node handles the Lightning payment while the payment gate enforces your pricing and access rules. Clients can pay and call your service through an L402-compatible app or agent.
Read the setup guideReady to explore l402 with your Phoenixd node?
Get Started