WebLN Guide
Ask or search…
K
🆕

webln.sendPaymentAsync()

Request that the user sends a payment for an invoice. The application needs to provide a BOLT-11 invoice. The payment will only be initiated and will not wait for a preimage to be returned. This is useful when paying HOLD invoices. There is no guarantee that the payment will be successfully sent to the receiver. It's up to the receiver to check whether or not the invoice has been paid.
This API may not be available on all providers.
Method
async function
sendPaymentAsync(paymentRequest: string): SendPaymentAsyncResponse;

Parameters

paymentRequest: string // the invoice you'd like the user to pay (lnbc...)

Response

interface SendPaymentAsyncResponse {} // no preimage returned!

Example

const invoice = "lnbc100...";
const result = await window.webln.sendPaymentAsync(invoice);

Demo

Last modified 4mo ago