nodana
SDKs / phoenixd-ts

phoenixd-ts

Use @nodana/phoenixd-ts to call your Phoenixd node's API from JavaScript or TypeScript. Create invoices, send payments, read balances and payment history, or subscribe to incoming payments. The client provides typed requests and responses.

Install

Use Node.js 22 or later:

npm install @nodana/phoenixd-ts

Create an invoice

For a Nodana-hosted node, copy its complete HTTPS URL from the node details in the dashboard and use the limited-access Phoenixd password you saved when creating the node. For your own daemon, use its reachable URL and the http-password-limited-access value from its configuration.

Set PHOENIXD_URL to that URL and PHOENIXD_PASSWORD to the limited-access password in your backend's environment or secret settings. The client connects directly to your node.

import { Phoenixd } from "@nodana/phoenixd-ts";

const node = new Phoenixd(process.env.PHOENIXD_URL!, process.env.PHOENIXD_PASSWORD!);

const invoice = await node.createInvoice({
  amountSat: 100,
  description: "Order 123",
});

console.log(invoice.serialized);

Give invoice.serialized to the payer. It is a Lightning invoice for 100 sats. The restricted password supports invoice creation and reading payment information; sending payments requires the full-access password (http-password).

See the Phoenixd API guide for authentication and API details, or use phoenixd-mpp-sdk or phoenixd-l402-sdk to accept Lightning payments for API requests.

On this page