> ## Documentation Index
> Fetch the complete documentation index at: https://docs.spark.money/llms.txt
> Use this file to discover all available pages before exploring further.

# fulfillSparkInvoice

> Pay one or more Spark invoices.

Fulfills one or more Spark invoices by paying them.

## Method Signature

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

## Parameters

<ResponseField name="sparkInvoices" type="{ invoice: SparkAddressFormat; amount?: bigint; }[]" required>
  Array of invoices to fulfill:

  * `invoice`: The Spark invoice to pay (must use `spark1...` prefix; legacy `sp1...` invoices are not supported)
  * `amount`: Amount to pay (required for invoices without an encoded amount; if both are provided, the encoded amount takes precedence)
</ResponseField>

## Returns

<ResponseField name="response" type="FulfillSparkInvoiceResponse" required>
  Response containing results for all invoice payment attempts
</ResponseField>

<Expandable title="FulfillSparkInvoiceResponse Type">
  ```typescript theme={null}
  interface FulfillSparkInvoiceResponse {
    // Successfully paid sats invoices
    satsTransactionSuccess: {
      invoice: SparkAddressFormat;
      transferResponse: WalletTransfer;
    }[];
    
    // Failed sats invoice payments
    satsTransactionErrors: {
      invoice: SparkAddressFormat;
      error: Error;
    }[];
    
    // Successfully paid token invoices
    tokenTransactionSuccess: {
      tokenIdentifier: Bech32mTokenIdentifier;
      invoices: SparkAddressFormat[];
      txid: string;
    }[];
    
    // Failed token invoice payments
    tokenTransactionErrors: {
      tokenIdentifier: Bech32mTokenIdentifier;
      invoices: SparkAddressFormat[];
      error: Error;
    }[];
    
    // Invoices that failed validation before payment
    invalidInvoices: {
      invoice: SparkAddressFormat;
      error: Error;
    }[];
  }
  ```
</Expandable>

## Example

```typescript theme={null}
// 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);
```
