Skip to content
Embedded Wallet
NFT Checkout

NFT Checkout

Simple Crypto supports buying NFTs with a credit or debit card to make it easy for anyone to purchase NFTs.

There are 2 steps to allow users to purchase NFTs with a credit card:

  1. Register your NFT(s) on Simple Crypto
  2. Integrate with Simple Crypto to purchase an NFT

Register

💡

Simple Crypto is currently doing a closed launch with select partners. If you’re interested in using NFT Checkout, please reach out to shekar@simplecrypto.dev.

Self serve coming soon.

Integrate

After you've registered a NFT with Simple Crypto, users will be able to purchase it via card or crypto.

For users that have sufficient crypto funds in their connected wallet, Simple Crypto will suggest paying in crypto; for users that don't, Simple Crypto will suggest paying with a credit card.

This removes the complexity you need to build, as you no longer have to create a separate flow to allow users to purchase NFTs with a card.

Example

Assume that the NFT you want your users to buy has the following function:

function buy(address to) public {
    usdc.safeTransferFrom(msg.sender, address(this), usdcPrice);
    mint(to);
}

The code below uses ethers.js, a popular Ethereum library written in typescript. Refer the the ethers.js documentation for more information on sending transactions to smart contracts.

import { ethers } from "ethers";
import SimpleCryptoSDK from "@simplecrypto/wallet-sdk";

/**
 * The address of your NFT. This is an example Simple Crypto NFT that is deployed on Polygon.
 */
const NFT_CONTRACT_ADDRESS = "0xc47785Cbe2CE8382d618C5Af4d8a343901c5672d";

const simpleCrypto = new SimpleCryptoSDK();
const provider = new ethers.providers.Web3Provider(simpleCrypto);

/**
 * Create an ethers.js Contract class which is a helpful class for interacting with your smart contracts.
 * The constructor takes 3 arguments:
 *   1. The address of the contract.
 *   2. The ABI of the contract. Normally this is a JSON file but ethers also supports
 *      human readable ABIs like you see below
 *   3. A "signer" which is used for signing and handling all requests to the blockchain. 
 *      The signer will need to use Simple Crypto under the hood to make requests to Simple Crypto.
 */
const nftContract = new ethers.Contract(
    NFT_CONTRACT_ADDRESS,
    ["function buy(address to) public"],
     provider.getSigner(),
);

async function buyNftWithCard() {
    const userAddress = await simpleCrypto.getAccount()

    await nftContract.buy(userAddress);
}

buyNftWithCard();

That's it! With just a few lines of code, you can enable your users to purchase NFTs on your site via Simple Crypto.

Last updated on February 4, 2023