Create a dapp to mint ERC721 tokens upon payment

Hi,

I am trying to setup the following on my website:
A payment button which opens metamask
When payment in ethereum is received, an erc-721 token is then sent to the ethereum address which made the payment.

Can someone give me some guidance on how best to do this?

1 Like

Hi @lav222dys,

Welcome to the community :wave:

I would create the ERC721 first (if you haven’t already), inheriting from an OpenZeppelin Contracts implementation of ERC721. (OpenZeppelin Contracts v3.0 final release candidate includes functionality for ERC721 automatic token URIs).

You could then create a contract which is given the minter role for your ERC721 and when payment is received mints a token and transfers it to the purchaser. (My preference is to keep the ERC721 and the sale of ERC721’s separate).

You should appropriately test and audit your solution.

Looking at the dapp side, you could start with the OpenZeppelin Learn guides on building a dapp https://docs.openzeppelin.com/learn/building-a-dapp (it depends if you have an existing website and what web tech stack you want to use).

I would also suggest looking at existing market places, as depending on the use case for your ERC721, then you could create the ERC721 and then sell it in marketplaces such as OpenSea

I have been quite generic with this answer, feel free to share more about your project and ask all the questions that you need.