Skip to Content
dApp 接入
本页目录

sendPayment

请求用户为发票进行支付。应用需要提供一个 BOLT-11 发票

方法

declare function sendPayment(paymentRequest: string): Promise<SendPaymentResponse>;
  • paymentRequest: 你希望用户支付的发票 (lnbc…)

响应

interface SendPaymentResponse { preimage: string; }

示例

const provider = (window.$onekey && window.$onekey.webln) || window.webln; const invoice = "<BOLT11_INVOICE>"; // Replace with a complete invoice. await provider.enable(); const info = await provider.sendPayment(invoice);

演示

打开示例 

最后更新于