Skip to main content
Creates a Spark invoice for receiving a sats payment on Spark.

Method Signature

async createSatsInvoice({
  amount,
  memo,
  senderSparkAddress,
  expiryTime,
  receiverIdentityPubkey,
}: {
  amount?: number;
  memo?: string;
  senderSparkAddress?: SparkAddressFormat;
  expiryTime?: Date;
  receiverIdentityPubkey?: string;
}): Promise<SparkAddressFormat>

Parameters

amount
number
The amount of sats to receive (optional for open invoices). Max: 2,100,000,000,000,000 sats (21M BTC).
memo
string
Optional memo/description for the payment
senderSparkAddress
SparkAddressFormat
Optional Spark address of the expected sender
expiryTime
Date
Optional expiry time for the invoice
receiverIdentityPubkey
string
Optional public key of the wallet receiving the invoice. If provided and different from the creator’s identity public key, the created invoice will be unsigned.

Returns

invoice
SparkAddressFormat
required
A Spark address/invoice that can be paid by another Spark wallet

Example

// Create an invoice for 1000 sats
const invoice = await wallet.createSatsInvoice({
  amount: 1000,
  memo: "Payment for coffee"
});
console.log("Spark invoice:", invoice);

// Create an open invoice (no amount specified)
const openInvoice = await wallet.createSatsInvoice({
  memo: "Tip jar"
});