provider.sendPayment
CoreAsk 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
invoicerequiredstringA valid encoded Fiber invoice, typically beginning with a network-specific fib prefix.
Response
NameTypeDescription
paymentHashrequiredHexPayment identifier returned by the Fiber node.
statusrequiredstringNode-reported payment state.
feerequiredHexRouting 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.