Buda Lightning Invoice wraps the Buda.com REST API using a local client —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.
buda-promise/buda.js — that handles all authentication and request signing on the server side. API consumers (your frontend or integration code) call the simple HTTP endpoints this service exposes and never need to know about Buda credentials or how to construct authenticated requests. The BUDA_API_KEY and BUDA_API_SECRET environment variables stay on the server, invisible to callers.
HMAC-SHA384 Authentication
Every private Buda.com API call is signed using HMAC-SHA384. The signing algorithm is implemented inBuda.prototype._authHeader and Buda.prototype._generateNonce inside buda-promise/buda.js.
Nonce generation
The nonce is a timestamp-plus-counter string that guarantees uniqueness even for multiple calls within the same millisecond:
Buda API Calls Made by This Service
Only two Buda endpoints are used in the current service implementation. Both require authentication. 1. Create a Lightning invoice —POST /api/v2/lightning_network_invoices
Called by helpers/getInvoice.js whenever POST /newinvoice or GET /callback is invoked.
Request payload:
expiry_seconds: false instructs Buda to apply its default invoice expiry. The response includes an invoice object from which the service extracts encoded_payment_request — the BOLT11 string returned to the caller.
2. Fetch BTC deposits — GET /api/v2/currencies/btc/deposits
Called by helpers/getPaymentConfirmation.js whenever POST /status is invoked.
The response contains a deposits array. The service scans every element looking for one where both conditions are true:
status: true is returned. Otherwise status: false.
Error Propagation
Buda API errors are caught insideBuda.prototype._request and re-thrown as a JavaScript Error with a consistent message format:
400 response:
ok: false in any 400 response and surface the error string to aid debugging.
Available Buda Client Methods
buda-promise/buda.js exposes a full set of Buda.com API methods beyond the two used by this service. If you extend the project, these are available:
| Method | Auth required | Description |
|---|---|---|
ticker(market) | No | Latest ticker data for a market |
order_book(market) | No | Current order book for a market |
trades(market, timestamp) | No | Recent trades for a market |
markets() | No | List all available markets |
fees(currency, type) | No | Deposit/withdrawal fee schedules |
get_quotation(market, type, amount, limit) | Yes | Get a price quotation |
balance(currency) | Yes | Account balance for a currency |
order_pages(market, per, page, state, minimun_exchanged) | Yes | Paginated order history |
new_order(market, type, price_type, limit, amount) | Yes | Place a new buy/sell order |
cancel_order(order_id) | Yes | Cancel an open order |
single_order(order_id) | Yes | Fetch a single order’s status |
deposits(currency, per, page, state) | Yes | List deposits for a currency ✦ |
withdrawals(currency, per, page, state) | Yes | List withdrawals for a currency |
withdrawal(currency, amount, target_address, simulate) | Yes | Initiate a crypto withdrawal |
lightning_withdrawal(amount, invoice, simulate) | Yes | Send a Lightning payment |
lightning_network_invoices(amount, currency, memo, expiry_seconds) | Yes | Create a Lightning invoice ✦ |
new_fiat_deposit(currency, amount, simulate) | Yes | Initiate a fiat deposit |
new_crypto_address(currency) | Yes | Generate a new deposit address |
get_address(currency, address_id) | Yes | Fetch an existing deposit address |