Sell a NFT

The following sample will show you how to sell a NFT using the Hedera Hashgraph and FileCoin to store the media. We will first generate a request for the end user. Once validated, you will get notified for the NFT's selling success.

circle-info

In order to guarantee the process, the NFT will be transferred on an escrow account. User could withdraw anytime and get NFT back.

Prerequisites:

Getting startedchevron-right

Step 1: Sell a NFT

/* Account ID of the seller */
$fromAccountId = ''; 
/* Unit Price per NFT in Hbar */
$hbarAmount = '';
/* Quantity for sale */
$quantity = '';
/* TokenId of the NFT */
$tokenId = '';
/* ID of the NFTs for sale */
 $nftIds = [];
/* Custom uniq ID */
$uniqId = '';
 /* Sell the nftIds under one QR Code */
$isCollection = '';
/* Define a Webhook */
$webhook = '';
/* Add 3rd-party payment */
$middleMen = [
    [
        'middleManAccountId' => '0.0...',
        'middleManTypeOfFees' => 'hbar',
        'middleManFees' => 10
    ],
];

$client -> sellNFT([
    $fromAccountId,
    $hbarAmount,
    $quantity,
    $tokenId,
    $isCollection,
    $nftIds,
    $uniqId,
    $middleMen
], $webhook);

Find more details on the webhook implementation herearrow-up-right

⭐ Congratulations! You have successfully set your NFT for sale !

Last updated