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

Method Signature

async createTokensInvoice({
  amount,
  tokenIdentifier,
  memo,
  senderSparkAddress,
  expiryTime,
}: {
  tokenIdentifier?: Bech32mTokenIdentifier;
  amount?: bigint;
  memo?: string;
  senderSparkAddress?: SparkAddressFormat;
  expiryTime?: Date;
}): Promise<SparkAddressFormat>

Parameters

tokenIdentifier
Bech32mTokenIdentifier
The Bech32m token identifier (e.g., btkn1...)
amount
bigint
The amount of tokens to receive. Max: 2^128 - 1.
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

Returns

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

Example

const invoice = await wallet.createTokensInvoice({
  tokenIdentifier: "btkn1...",
  amount: 1000n,
  memo: "Token payment"
});
console.log("Token invoice:", invoice);