Skip to main content
Fulfills one or more Spark invoices by paying them.

Method Signature

async fulfillSparkInvoice(
  sparkInvoices: {
    invoice: SparkAddressFormat;
    amount?: bigint;
  }[]
): Promise<FulfillSparkInvoiceResponse>

Parameters

sparkInvoices
array
required
Array of invoices to fulfill:
  • invoice: The Spark invoice to pay (must use spark1... prefix)
  • amount: Amount to pay (required for invoices without encoded amount)

Returns

response
FulfillSparkInvoiceResponse
required
Response containing results for all invoice payment attempts

Example

// Pay a single invoice
const result = await wallet.fulfillSparkInvoice([
  { invoice: "spark1..." }
]);

// Pay multiple invoices with amounts
const batchResult = await wallet.fulfillSparkInvoice([
  { invoice: invoiceWithNoAmount, amount: 1000n },
  { invoice: invoiceWithEncodedAmount }
]);

// Check results
console.log("Successful:", result.satsTransactionSuccess);
console.log("Errors:", result.satsTransactionErrors);