webln.makeInvoice
Request that the user create an invoice for use by the app. This will return a BOLT-11 invoice. Invoices can be requested in a few forms:
amount
, the user's provider should enforce that the user generate an invoice with a specific amountminimumAmount
and / or maximumAmount
, the user's provider should enforce that the user generate an invoice with an amount field constrained by that amountamount
is not set, the user can return an invoice that has no amount specified, allowing the payment maker to send any amountNote that these constraints are enforced by the client's provider, and therefore should not be completely trusted. If you want to check the fields that come back, or otherwise use the data encoded in the invoice, you'll want to use a library to decode it such as the bolt11 npm package.
Amounts are denominated in satoshis. For large amounts, it's recommended you use a big number library such as bn.js as Javascript only supports 53 bit integers.
function makeInvoice(args: RequestInvoiceArgs): Promise<RequestInvoiceResponse>;
interface RequestInvoiceArgs {
amount?: string | number;
defaultAmount?: string | number;
minimumAmount?: string | number;
maximumAmount?: string | number;
defaultMemo?: string;
}
interface RequestInvoiceResponse {
paymentRequest: string;
}
webln.makeInvoice();