With the recent shutdown of Paper, many developers are searching for a reliable alternative to continue accepting credit card payments for NFTs. Cometh Checkout offers a robust and easy-to-integrate solution designed to minimize friction. This guide will walk you through the migration process quickly and efficiently.
Here’s an example of a typical implementation with Paper:
<CheckoutWithCard configs={{ "contractId": "914d6c3b-1f67-45e5-9694-c4170b2c868b", "walletAddress": "0xc8186a3044D311eec1C1b57342Aaa290F6d90Aa5", "title": "Hello World", "mintMethod": { "name": "claimTo", "args": { "_to": "$WALLET", "_quantity": "$QUANTITY", "_tokenId": 0 }, "payment": { "currency": "MATIC", "value": "0.0001 * $QUANTITY" } } }} onPaymentSuccess={(result) => console.log(result)} onReview={(result) => console.log(result)} onError={(error) => console.error(error)} options={{ colorBackground: '#F7F0FF', colorPrimary: '#7371FC', colorText: '#222222', borderRadius: 6, inputBackgroundColor: '#F5EFFF', inputBorderColor: '#7371FC', }} />
This method involved specific contract configuration and callbacks to track transactions.
Before migrating, ensure your NFT collection meets the following requirements to work with Cometh Checkout:
1. Mandatory Recipient Parameter: Your mint method must accept a recipient parameter that our system can sign and specify for the end user.
2. USDC Payment: Your contract must accept USDC as the payment method, with the entire amount transferred from the sender’s wallet to the smart contract during the transaction.
Here’s an example of a contract that meets these requirements:
contract MyNFT is ERC721, ERC721Burnable { uint256 private _nextTokenId; address public owner; IERC20 public immutable usdc; uint256 public immutable price; using SafeERC20 for IERC20; constructor(address _usdc, uint256 _price) ERC721("MyNFT", "NFT") { owner = msg.sender; usdc = IERC20(_usdc); price = _price; } function mint(address to) public { usdc.safeTransferFrom((msg.sender), address(this), price); usdc.safeTransfer(owner, price); uint256 tokenId = _nextTokenId++; _safeMint(to, tokenId); } }
For more details on the necessary setup, consult the Cometh Checkout documentation.
Cometh Checkout simplifies integration by allowing you to generate a unique payment URL for each transaction. Here’s how you can migrate:
function generateCheckoutUrl(baseUrl) { const url = new URL(baseUrl); const params = new URLSearchParams(url.search); const apiKey = "your_api_key"; const productId = "4"; const userEmail = "USER_EMAIL"; const userWallet = "USER_WALLET"; params.set("checkout_api_key", apiKey); params.set("product_id", productId); params.set("user_wallet", userWallet); if (userEmail) params.set("user_email", userEmail); url.search = params.toString(); return url.toString(); }
Integrate this payment URL directly into your application or website to enable users to purchase NFTs with their credit cards.
Once integrated, your visitors can pay with over 20 different payment methods, including major credit cards, Apple Pay, Google Pay, and more.
Migrating from Paper to Cometh Checkout is straightforward, allowing you to continue NFT payments without interruption. You can create a free Cometh account, set up your project, and test the minting and payment flow on a testnet before moving to production.