Interactive Modal Integration
Integration guidelines for NFT Checkout feature
Prerequisite
The platform needs to create at least one Tweed account in order to communicate with the backend. Creating a Tweed account can be done using the sdk.wallet.create() function with userId and userEmail, once a user was created successfully - use the same user to use the Tokens checkout product.
Frontend Integration
The frontend part is very easy to integrate, simply call the function: sdk.token.buyWithFiat("TOKEN_ID", "WALLET_ADDRESS")
, it will cause the getTokenPurchaseData
callback on the backend to fire with the tokenId parameter pre populated by the frontend, you can use the tokenId to know which token the user wanted to purchase and run logic accordingly.
The wallet address parameter will try to populate the argument toWalletAddress
in the abi string in the backend, in the absence of this argument in the frontend the wallet address of the user will be used to populate it,
Backend Integration
During the setup of the backend SDK, the platform supplies a callback function getTokenPurchaseData that gets an tokenId
and returns an TOKEN_INFO
object.
Setting up the backend SDK:
The platform should implement the following callback function:
TOKEN_INFO
object
TOKEN_INFO
objectThis object is where you specify all of your Token's information, including pricing.
Specify whether you want to be paid out in fiat or in crypto in the NFT_INFO
object.
You must fill out either priceInCrypto
or priceInCents
for each Token.
You can only be paid out in crypto or in fiat for each Token, not a combination of both for each Token. You can, however, have a mixture of Tokens paid out in crypto and Tokens paid out in fiat. See Payout Setup for more details.
Smart Contract Prerequisites
We don't have any limitations on how your contract looks or how many arguments your mint
function uses.
There are only two prerequisites:
Our claimer needs to have a minter role in the contract.
In case you want to get settled in native crypto currency, the mint function needs to be payable.
The abi
parameter should contain the name of the function and its arguments declerations,
similar to the following example:
safeMint(sendTo address, tokenId uint256, tokenUri string)
.
The arguments needs to get populated into thecustomMintParams
object like so:
Tezos integration consideration
In the
abi
parameter of theNFT_INFO
only the function name is needed without the list of paramsThe
customMintParams
parameter will hold the list of arguments the function in theabi
gets and translate them to their michelson representationFor ex:
Last updated