USDC Support

Accept USDC payments on your smart contract

Setting up your smart contract to accept USDC payments can create a more seamless experience for mainstream users and eliminate price volatility.

Adding USDC support for EVM NFTs


There are a few key differences between native cryptocurrency and USDC minting worth highlighting.

  • The mint function should be nonpayable
  • USDC is a 6 decimal token instead of 18 like Ethereum, MATIC, and many others.

Keep in mind mind the totalPrice attribute in the mintConfig of your button code should be in units of USDC. So if your intended price is 100 USD then you will set totalPrice to 100 like so: totalPrice="100".

👍

IMPORTANT

Crossmint sends transactions from a treasury account, but mints to the user's custodial wallet. Because of this your ERC 20 transfer function must request the funds from msg.sender instead of the address parameter. Below is an example mint function to help guide you.

function mintUSDC(address _to) public onlyCrossmint {
    // pre payment logic here
    
    // note that you need to transfer from msg.sender, NOT the _to address
    tokenInstance.safeTransferFrom(msg.sender, address(this), priceUSDC );

    // actual minting logic here
  }

Click here for more details on setting up the button for React and Vanilla-JS

Ethereum/Polygon USDC Token Addresses Table


USDC is simply an ERC-20 token. This means that you need to use the same token address as Crossmint when testing your contracts, otherwise the token transfers and minting will not work. Below is the table of official addresses we are using.

NetworkUSDC Token Address
Ethereum Mainnet0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Ethereum Goerli Testnet0x98339D8C260052B7ad81c28c16C0b98420f2B46a
Polygon Mainnet0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174
Polygon Mumbai Testnet0xFEca406dA9727A25E71e732F9961F680059eF1F9

Adding USDC support for Solana NFTs


Adding USDC support to your candy machine is handled entirely in your candy machine configuration. Crossmint will automatically detect the setup when you add credit card support to your collection. More details in the linked guide below:

Here is a guide on how to set it up for a Solana drop.