mintMethod is required for custom contracts only.
If your contract uses thirdweb, Auction House, or Candy Machine contracts, see contractArgs.
The mintMethod field in the Checkout APIs instructs Paper to mint an NFT from your smart contract to the buyer.
Example
Assume your NFT costs 0.1 ETH and is minted with this method:
function claimTo(address _to, uint256 _quantity) public payable
The mintMethod should be:
"mintMethod": {
"name": "claimTo",
"args": {
"_to": "$WALLET",
"_quantity": "$QUANTITY"
},
"payment": {
"value": "0.1 * $QUANTITY",
"currency": "ETH"
}
}
Template variables
The following template variables will be replaced when calling your contract:
Variable | Replaced with |
---|---|
$WALLET | The buyer's wallet address. |
$QUANTITY | The quantity of tokens to mint. |
Payment
The payment
field should provide the price per NFT in human-readable form (not wei).
Example: "payment": { "value": "0.1 * $QUANTITY", "currency": "ETH" }
for an NFT that costs 0.1 ETH per token.
Free NFTs
Set the price to zero.
Example: "payment": { value: "0 * $QUANTITY", currency: "MATIC" }
NFTs priced in USDC
Ensure your mint method explicitly requests USDC tokens from msg.sender. See USDC Pricing for more details.
Delegate a different ERC-20 payment address
By default Paper's float wallet approves your NFT contract to request ERC-20 tokens.
To specify a different contract address that will request ERC-20 tokens from Paper's float wallet, set that address in the "spender"
field:
"payment": {
"value": "100 * $QUANTITY",
"currency": "USDC",
"spender": "<PAYMENT CONTRACT ADDRESS>"
}