purchase
purchase
purchase(params) → Receipt
Initiates a purchase for the specified product.
This method may trigger multiple write transactions (e.g., token approval and minting).
Parameters
Parameter
Type
Required
Description
confirmations
number
❌
Number of confirmation blocks (Default 1)
Returns: Receipt
The receipt contains the confirmed transaction metadata under transactionReceipt and an order object with parsed token details for the mint that was executed.
Example
const receipt = await product.purchase({
account,
preparedPurchase,
});
console.log('Mint transaction:', receipt.transactionReceipt.txHash);
if (receipt.order) {
console.log('Recipient:', receipt.order.recipientAddress);
for (const item of receipt.order.items) {
console.log(`Minted token ${item.token.tokenId} x${item.quantity}`);
}
}Last updated