Skip to main content
Creates a Lightning invoice for receiving payments via the SparkWallet.

Method Signature

type CreateLightningInvoiceParams = {
  amountSats: number;
  memo?: string;
  expirySeconds?: number;
  includeSparkAddress?: boolean;
  receiverIdentityPubkey?: string;
  descriptionHash?: string;
};

async createLightningInvoice(params: CreateLightningInvoiceParams): Promise<LightningReceiveRequest>;

Parameters

amountSats
number
required
Amount in satoshis to receive. Use 0 for zero-amount invoices. Must be a safe integer (less than 2^53).
memo
string
Optional memo/description for the invoice (max 639 characters). Cannot be used together with descriptionHash.
expirySeconds
number
Invoice expiry time in seconds (default: 2,592,000 = 30 days)
includeSparkAddress
boolean
Whether to embed Spark address in the invoice fallback field. Note: If the payer uses the fallback address instead of Lightning, the payment cannot be correlated to this invoice—it appears as a separate Spark transfer.
receiverIdentityPubkey
string
33-byte compressed identity pubkey for generating invoices for other Spark users
descriptionHash
string
SHA256 hash of the description for BOLT11 description_hash field. Cannot be used together with memo.

Returns

request
LightningReceiveRequest
required
The Lightning receive request object containing:
  • id: Unique identifier for the request
  • invoice: Invoice object with encodedInvoice, paymentHash, amount, etc.
  • status: Request status
  • createdAt, updatedAt: Timestamps
Access the BOLT11 invoice string via request.invoice.encodedInvoice.

Example

const request = await wallet.createLightningInvoice({
  amountSats: 1000,
  memo: "Payment for services",
  expirySeconds: 3600 // 1 hour
});

console.log("Lightning invoice:", request.invoice.encodedInvoice);
console.log("Request ID:", request.id);
console.log("Payment hash:", request.invoice.paymentHash);