Buda Lightning Invoice is an Express.js service that acts as a server-side bridge between your application and the Buda.com exchange API, enabling you to create and verify Bitcoin Lightning Network invoices over plain HTTP. It is designed for developers who want to accept Lightning payments backed by a real Buda.com exchange account — without exposing any exchange credentials to the outside world. Your frontend or downstream service calls simple REST endpoints; all authentication with Buda lives exclusively on the server.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/nicosaporiti/buda-lightning-invoice/llms.txt
Use this file to discover all available pages before exploring further.
What it does
The service exposes four public endpoints that cover the full Lightning payment lifecycle:| Endpoint | Method | Purpose |
|---|---|---|
/newinvoice | POST | Creates a new BOLT11 Lightning invoice on Buda.com for a given amount (in satoshis) and memo. |
/status | POST | Checks whether a specific invoice has been paid by looking for a confirmed deposit on Buda.com. |
/.well-known/lnurlp/:username | GET | Returns the LNURL-pay metadata document needed to support a Lightning Address (e.g. user@your-domain.com). |
/callback | GET | LNURL-pay callback invoked by a payer’s wallet — accepts an amount in millisatoshis, converts it to satoshis, and returns a fresh invoice. |
The four endpoints above require no authentication from API consumers. Buda.com credentials (
BUDA_API_KEY and BUDA_API_SECRET) are loaded from server-side environment variables and are never exposed to clients.Architecture overview
Every request travels through a consistent pipeline before reaching Buda.com and returning a response:Route layer
routes/buda.js matches the incoming HTTP method and path, then runs express-validator rules to validate and sanitize request inputs before any business logic runs.Validation middleware
middlewares/fields-validator.js collects validation errors and short-circuits the request with a structured 400 response if any check fails, keeping controllers clean.Controller
controllers/buda.js orchestrates the response: it calls the appropriate helper, handles errors, and serializes the final JSON result.Helper
Focused helper modules (
getInvoice.js, getPaymentConfirmation.js) contain the core business logic — invoice creation and deposit confirmation lookups.When to use this
Buda Lightning Invoice is a good fit whenever you need Lightning payments tied to a Buda.com account:- Micropayments — accept sub-cent Bitcoin payments for digital goods or services.
- Donation systems — embed a Lightning Address (e.g.
donations@your-domain.com) on a website or profile. - Paywalls — gate access to content or APIs behind a pay-per-view Lightning invoice.
- Lightning Address backend — serve the LNURL-pay and callback endpoints required by the Lightning Address specification.
- LLM / agent pay-per-call — let AI agents pay for API access autonomously using Lightning, with each call generating a fresh invoice.
Prerequisites
Before running Buda Lightning Invoice, make sure you have:- Node.js 20 — the Dockerfile and README both target Node
20.18.0; earlier versions are untested. - npm — used for dependency installation and running scripts.
- A Buda.com account with an API key and secret that have deposit and Lightning Network permissions enabled.
Quickstart
Install the project, configure your environment, and create your first Lightning invoice in under 5 minutes.
Configuration
Explore every environment variable, npm script, and credential setup option in detail.