Commerce Flow

The Commerce Flow is the preferred integration path for MoonPay.

Step 1: Ensure you meet our product pre-requisites

Before setting up NFT Checkout, you'll need to check you meet all the requirements to use our product.

  • You’re looking to enable fiat payments on a primary drop or primary sale where you are the seller and / or creator.
  • You're looking to complete a drop on Ethereum or Polygon (more chains coming soon) and the NFTs are priced in their native network currency (i.e. MATIC or ETH)
  • The NFTs have a USD value of between $3 & $15,000.
  • You can have an existing smart contract on the list below:
    • ThirdWeb
    • Custom ERC1155 compatible Smart Contract
    • Custom ERC721/ERC721a compatible Smart Contract

If your contract is custom, please refer to the section below on Custom Smart Contract Requirements.

Custom Smart Contract Requirements

Basic NFT Smart Contract requirements are described here

Mint method

As a crucial part of the transaction flow, our system will directly invoke your mint function. To ensure seamless operation, please adhere to the following requirements for your mint function:

  • Name of the Function: The mint function can have any name. We do not make assumptions in this regard. During the collection setup process, you will inform us about the specific name of your mint function.
  • Number of Arguments: The mint function can accommodate any number of arguments. The design is flexible to suit a wide range of use cases.
  • Buyer Wallet Address Argument: The function must have an argument to accept the buyer's wallet address. This is the address of the customer making the purchase.
  • Quantity Argument: The function must also include an argument to specify the number of NFTs to mint.
  • NFT Destination: The newly minted NFTs should be sent to the msg.sender ❗❗❗.

Here's an example of a mint function that satisfies these requirements:

function claimTo(address _to, uint256 _quantity, bytes _proof) public payable

If you wish to limit contract calls exclusively to MoonPay, this can be achieved by requiring the msg.sender to match MoonPay's smart contract address. Please refer to the table below for the correct address.

Allow lists:

If your smart contract incorporates an Allow List, it's vital to undertake the following steps to ensure a smooth and secure minting process:

  • Buyer Wallet Address Verification: Always compare the buyer wallet address given as an argument in the mint function call against the Allow List. This verification step ensures that only authorized users can mint tokens.
  • MoonPay Address Access: Grant the MoonPay address permissions to mint an unlimited number of NFTs at any time. The ability to mint without restrictions is crucial for MoonPay to operate effectively.

Passing additional arguments to mint function:

Sometimes the mint function of your NFT smart contract may require additional data. This extra information can be provided within the 'mintData' field, which is nested within the metadata query parameter. This parameter comes into play when you're initializing the widget.

Example

For example, consider a situation where your mint function ABI (Application Binary Interface) has the following structure:

function mint(address _to, uint256 _quantity, uint256 _maxQuantity) public payable

And, let's assume the collection ID for your NFT is 'abc-123-xyz'. (Collection id will be generated for you after successful collection creation in MoonPay Dashboard)
Under these circumstances, you would pass the metadata object to the widget URL. It serves as a parameter, providing the necessary context for the widget operation.

Note: The metadata object provides the necessary data fields (_maxQuantity, moonpayCollectionId) and their corresponding values. It's crucial to ensure the correct structure and values within the metadata object to facilitate successful mint function operations.

const metadata = encodeURIComponent(JSON.stringify({
  moonpayCollectionId: β€œabc-123-xyz”,
  mintData: {
    _maxQuantity: 5,  // Key name has to match argument name in the mint function!!
  }
}))

πŸ“˜

Please note: Adhering to these guidelines will ensure a smooth transaction flow and avoid potential issues during the minting process.

MoonPay's Smart Contract addresses:

List of all addresses available here

Step 2: Login to your MoonPay Dashboard account

Set up and configuration of your NFT Checkout account is done within the MoonPay Developer Dashboard. If you've already spoken to a member of our partnerships team, you should have an email with instructions of how to login. If don't yet have a MoonPay Dashboard account, please email [email protected] with the subject line NFT Commerce.

Link to access the MoonPay Dashboard

Step 3: Navigate to NFT Commerce on your Dashboard sidebar

Locate the 'NFT Commerce' tab on your MoonPay Dashboard account and click!

Please note: There is a waitlist for the product so this tab is not exposed by default. Please email [email protected] if this tab is not visible to you.

Step 4: Create your Collection and add basic details

Click 'Create NFT Collection' and start setting up your collection. You can select a Collection Name, Collection Description, upload an image of the collection, and select a Network (i.e. Polygon or Ethereum). The name, description, and image you used will be displayed within our NFT Checkout widget for your users to see!

Step 5: Register Your Contract

In order to execute the mint on behalf of our end-user, we need to know more about the collection you’re selling and the smart contract you’re using. You’ll need to provide some basic information, such as the collection name, the NFT image, and the price.

We also need an ABI of your mint function in your smart contract. If you’re using ThirdWeb, all you need to do is tell us via the β€˜contract type’ drop down. If you’re using a custom smart contract, select the contract type and then paste your mint function ABI into the ABI field below.

Step 6: Integrate the widget

You've made it to the final step of the integration: incorporating the widget. This essential component enables buyers to place orders for an NFT. You have two methods to achieve this:

  • Direct Widget URL Use: If your smart contract does not require any extra arguments and you don't plan to use additional widget parameters, the process is straightforward. Simply click on "Copy widget URL" adjacent to the collection in your Dashboard. Then, use this URL to display the widget within an iFrame on your website.
  • Widget Customization: If you wish to personalize the widget or need to pass extra arguments to your smart contract, you have the flexibility to do so. To learn more about customizing and displaying the widget, you can Learn more about displaying the widget.

SDK support is coming soon!

πŸ“˜

If you have additional questions on our Commerce Flow see our NFT Checkout FAQ.