FFiber WebLN
API / Provider / provider.sendPayment

provider.sendPayment

Core

Ask the provider to pay a Fiber invoice after the user reviews its decoded details.

Signature

function sendPayment(invoice: string): Promise<SendPaymentResult>
PERMISSION

Requires enable(), an explicit payment confirmation, and provider unlock when configured.

Parameters

NameTypeDescription
invoicerequiredstring

A valid encoded Fiber invoice, typically beginning with a network-specific fib prefix.

Response

NameTypeDescription
paymentHashrequiredHex

Payment identifier returned by the Fiber node.

statusrequiredstring

Node-reported payment state.

feerequiredHex

Routing fee in the payment asset's smallest unit.

Example

try {
  const payment = await fiber.sendPayment(invoice);
  console.log(payment.status, payment.paymentHash);
} catch (error) {
  if (error instanceof UserRejectedError) return;
  throw error;
}

Provider behavior

W

WASM node

Uses fiber-js parseInvoice() to build the approval preview, then calls sendPayment() inside the offscreen node.

R

Remote fnn

Uses fnn parse_invoice for the preview and fnn send_payment after approval.

Notes

  • Never trust an amount displayed by the dApp when the provider can decode the invoice itself.

Errors