Buy a NFT from QR Code

There is another way to buy a NFT. You can also show a QR code on any page ! Once scanned via the Xact Wallet application, the end user will be able to process the payment.

Prerequisites:

Step 1: Import the following modules

Let's continue building on the index.js from the previous example (Environment Set-up) and add the following modules:

const { Client, CategoryNFT } = require("@xact-wallet-sdk/client");
require("dotenv").config();

Step 2: Get your NFT

Please Note that your NFT need to be on sale.

const tokenId = '' /* tokenId of the NFT */
const sellerAccountId = '' /* Account ID of the seller */
const nftId = '' /* nftId is Optional for old token */

const res = await client.getNFTForSaleByTokenId({tokenId, sellerAccountId, nftId});

console.log("your NFT", res.nft, "::QRCode", res.qrCode);

Last updated