
Lightning Withdrawal Flow
The complete process for withdrawing Bitcoin from Spark to the Lightning Network:1
Get Lightning Invoice
Obtain a Lightning invoice from the recipient or Lightning service.
2
Estimate Fees
Get a fee estimate for the Lightning payment to understand costs.
3
Pay Invoice
Send the Lightning payment with appropriate fee limits.
4
Monitor Payment
Track the payment status until completion.
Pay Lightning Invoice
Send Bitcoin from your Spark wallet to any Lightning Network invoice.payLightningInvoice(params)
Pays a Lightning invoice using your Spark wallet balance.
Get Fee Estimate
Estimate the fees for a Lightning payment before sending.getLightningSendFeeEstimate(params)
Gets an estimated fee for sending a Lightning payment.
Monitor Payment Status
Track the status of your Lightning payment.getLightningSendRequest(id)
Gets a Lightning send request by ID to check payment status.
Zero-Amount Invoices
Spark supports paying zero-amount Lightning invoices, which allow you to specify the amount when making the payment.Zero-amount invoices are not widely supported across the Lightning Network. Some exchanges, such as Binance, currently do not support them.
Paying Zero-Amount Invoices
When paying a zero-amount invoice, you need to specify the amount using theamountSatsToSend parameter:
The
amountSatsToSend parameter is only used for zero-amount invoices. For regular invoices with a fixed amount, this parameter is ignored.Spark Transfer Preference
When paying Lightning invoices, you can enable Spark transfer preference to automatically use Spark transfers when possible.preferSpark is set to true, Spark wallets will:
- Initiate a Spark transfer instead of a Lightning transfer if a valid Spark address is found in the invoice
- Fall back to regular Lightning payment if no Spark address is found
Real-time Payment Monitoring
Monitor Lightning payment status by polling.Fee Recommendations
We recommend setting the maximum routing fee to whichever is greater:- 5 sats (minimum fee)
- 17 bps × transaction amount (0.17% of the transaction)
