I want to create nft where people buy it using another erc-20 token not eth or bnb is this possible where to start?
Yes this is possible.
I have published a project showing exactly how to do this, including full documentation and walkthrough. It is at https://github.com/fulldecent/spend-ERC20-create-ERC721
Here is a summary of how it works:
ERC-721 certificate contract — This is a standard ERC-721 contract implemented using the 0xcert template with additional functions:
create(bytes32 dataHash) returns (uint256)— Allows anybody to create a certificate (NFT). Causes the side effect of deducting a certain amount of money from the user, payable in ERC-20 tokens. The return value is a serial number.
hashForToken(uint256 tokenId) view— Allows anybody to find the data hash for a given serial number.
mintingPrice() view— Returns the price.
mintingCurrency() view— Returns the currency (ERC-20)
setMintingPrice(uint256)— Allows owner (see 0xcert ownable contract) to set price
setMintingCurrency(ERC20 contract)— Allows owner (see 0xcert ownable contract) to set currency
ERC-20 token contract — This is a standard ERC-721 contract implemented using the OpenZeppelin template for ERC-20 including Minter extension also with additional functions:
renounceSpender()— A new role for tracking who may spend these tokens, see OpenZeppelin roles library
spend(account from, uint256 value)— Allows an authorized spender to deduct money from a specific account's balance
mint(address to, uint256 value)— FOR DEMO PURPOSES ONLY. This implements the Minter role to allow ANYBODY to create tokens for free. This allows the demo to be used for anybody free of cost.
This work was sponsored by Arianee. It has worked in the past and some changes may be required to update this to work with modern MetaMask, current NFT implementation and current Solidity versions. If you would like to see updates on those things, let's discuss.