Skip to content

Latest commit

 

History

History
33 lines (22 loc) · 664 Bytes

File metadata and controls

33 lines (22 loc) · 664 Bytes

sendPayment

Request that the user sends a payment for an invoice. The application needs to provide a BOLT-11 invoice

Method

async function sendPayment(paymentRequest: string): SendPaymentResponse
  • paymentRequest: The invoice you'd like the user to pay (lnbc...)

Response

interface SendPaymentResponse {
  preimage: string;
}

Example

const provider = (window.$onekey && window.$onekey.webln) || window.webln;

const invoice = "lnbc100xxxx";
await provider.enable();
const info = await provider.sendPayment(invoice);

Demo

{% embed url="https://codepen.io/OneKeyHQ/pen/OJdomvO" %}