Developer Guide
  • Getting Started
    • Why NFTpay
  • NFTpay Services
    • Simple NFT Payments
    • PureCharge API
    • Marketplaces
    • Web3 Gaming
    • Minting Platforms
    • USDC, USDT and BUSD Support
    • Wallet API
    • Whitelists and Allowlists
    • Mint to Destination
    • Conversion Analytics
    • Marketing Service
    • NFT Minting Services
    • Thirdweb and Tuple Support
    • Integrating Thirdweb with NFTpay
    • Embeddable NFT Collection Widget
    • Individual Wallet
  • Integration Docs
    • ⚡How it works
    • ⚡QuickStart
    • ⚡Adding your project
    • ⚡The Sandbox environment
    • ⚡The live environment
    • ⚡Changing the price
    • ⚡Checking sales
    • ⚡Adding NFTpay to your site
    • ⚡Example Mint Function
    • ⚡Locking email
    • ⚡API Check
    • ⚡Automated Collection Deployment
  • FAQ
Powered by GitBook
On this page
  1. Integration Docs

Example Mint Function

Here is an example mint function on Ethereum that works well with NFTpay

  function purchase(uint256 num) public payable {
        uint256 supply = totalSupply();
        require( num < 21,                              "You can purchase a maximum of 20 NFTs" );
        require( supply + num < 10000 - _reserved,      "Exceeds maximum NFTs supply" );
        require( msg.value >= _price * num,             "Ether sent is not correct" );

        for(uint256 i; i < num; i++){
            _safeMint( msg.sender, supply + i );
        }
    }
PreviousAdding NFTpay to your siteNextLocking email

Last updated 2 years ago

⚡