Creates a Spark invoice for receiving a sats payment on Spark.
Method Signature
async createSatsInvoice({
amount,
memo,
senderSparkAddress,
expiryTime,
}: {
amount?: number;
memo?: string;
senderSparkAddress?: SparkAddressFormat;
expiryTime?: Date;
}): Promise<SparkAddressFormat>
Parameters
The amount of sats to receive (optional for open invoices). Max: 2,100,000,000,000,000 sats (21M BTC).
Optional memo/description for the payment
Optional Spark address of the expected sender
Optional expiry time for the invoice
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"
});