Skip to main content
Receive Bitcoin via Lightning invoices with instant settlement into Spark.
Deposit from Lightning

Understanding Lightning Invoices

To send and receive Lightning payments, you can generate and pay Lightning invoices. A Lightning invoice (also called a payment request) is a specially formatted string that contains all the information needed to make a Lightning Network payment:
  • Amount: How many satoshis to send (can be omitted for zero-amount invoices)
  • Destination: The recipient’s node public key
  • Payment Hash: A unique identifier for the payment
  • Description: Optional memo describing the payment
  • Expiry: How long the invoice is valid for (default 24 hours)
Lightning invoices start with “ln” followed by the network identifier (bc for mainnet) and typically look like this: lnbc1... Mainnet invoice Example:

Lightning Deposit Flow

The complete process for receiving Lightning payments into your Spark wallet:
1

Create Invoice

Generate a Lightning invoice with the desired amount and description.
2

Share Invoice

Provide the invoice to the sender (via QR code, link, or text).
3

Monitor Payment

Track the payment status until completion.

Create Lightning Invoice

Generate Lightning invoices to receive Bitcoin payments that will be deposited into your Spark wallet. createLightningInvoice(params) Creates a Lightning invoice for receiving Bitcoin payments.

Spark Payment Integration

Spark provides two ways to enable Spark-based payments alongside Lightning invoices:

Option 1: Spark Invoice in Routing Hints

By setting includeSparkInvoice: true, a Spark invoice is embedded in the routing hints section of the BOLT11 invoice. This allows Spark-compatible wallets to automatically detect and pay over Spark instead of Lightning, providing a seamless user experience:
When a payer uses this invoice:
  • Spark-compatible wallets can pay directly over Spark (faster, potentially lower fees)
  • Non-Spark wallets will pay via Lightning as normal
  • The payment is correlated to the original invoice

Option 2: Spark Address in Fallback Field

By passing in true for includeSparkAddress, a 36-byte string consisting of a recognizable header and a receiver’s compressed identity public key SPK:identitypubkey will get embedded in the fallback address (f) field of a BOLT11 invoice:

Fallback Address Format

The embedded Spark address in the fallback field will look something like this:
Important: These two options are mutually exclusive. You cannot use both includeSparkAddress and includeSparkInvoice in the same invoice.

Creating Invoices for Other Spark Users

To generate an invoice for another Spark user, pass in the 33-byte compressed identity pubkey as a string to receiverIdentityPubkey:
If a wallet is generating an invoice for itself and wants to embed its own Spark identity in the invoice, it will not need to pass in a receiverIdentityPubkey to embed a Spark address. That will get taken care of on the backend. Passing it in shouldn’t change anything though.

Zero-Amount Invoices

Spark supports creating zero-amount Lightning invoices. Zero-amount invoices don’t have a fixed amount and allow the sender 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.

Creating Zero-Amount Invoices

To create a zero-amount invoice, pass 0 for the amountSats parameter:

Monitor Lightning Payments

Track incoming Lightning payments and their status using receive request monitoring. getLightningReceiveRequest(id) Gets the status of a Lightning receive request by ID.

Real-time Payment Monitoring

Use event listeners to monitor Lightning payments in real-time.