Skip to main content
Pays a Lightning invoice via the SparkWallet.

Method Signature

Parameters

string
required
The BOLT11-encoded Lightning invoice to pay
number
required
Maximum fee in satoshis to pay for the invoice
boolean
When true, initiate a Spark transfer if a valid Spark address is found in the invoice (default: false)
number
Amount in satoshis to send for zero-amount invoices
string
Optional client-provided idempotency key for deduplication. Multiple requests with the same key will return the same result instead of creating duplicate payments or returning errors. Use this to prevent duplicate transactions when retrying failed requests.

Returns

LightningSendRequest | WalletTransfer
required
The Lightning payment request details, or a WalletTransfer if preferSpark is true and a valid Spark address was found in the invoice
The payment preimage is not returned immediately. To retrieve the preimage after payment completes, call getLightningSendRequest(id) with the returned request ID.
When preferSpark: true and the invoice contains a valid Spark fallback address, the method returns a WalletTransfer instead of LightningSendRequest. If no valid Spark address is found, it falls back to Lightning.

Examples