Skip to main content
Crossmint Embedded Checkout Demo

You will build this demo

Introduction

In this guide, you will create a web app with Next.js which allows customers to buy NFTs or tokens with credit card and crypto payments, using Crossmint’s embedded checkout. If you want to get started immediately, you can clone a repo with a functioning embedded checkout here: https://github.com/Crossmint/crossmint-embedded-demo. If you want to get started step by step, continue following the guide below.

From Crossmint

  1. Create a developer account in the Staging Console.
  2. Create a new collection or import yours into the console, and have your collectionId ready.
    • Make sure you follow the maximum prices for collections set in staging outlined here.
  3. Create a client-side API key with the orders.create scope enabled. More info on creating API keys here.
To integrate in production/mainnet, you'll also need to complete account and collection verification. More information in the production launch guide.
For Marketplaces and Launchpads: You do not need to create a collection (skip Step 2).Simply use tokenLocator instead of collectionLocator in the examples. It is recommended to test tokenlocator in the production environment.See Marketplaces & Launchpads guide for more secondary-sale specific details.

Integration Steps

This guide will start from scratch with an empty Next.js application. You'll install the required @crossmint/client-sdk-react-ui dependency and add the embedded checkout component. To get started:

Set up the Project

1

Create a new Next.js application

If you see this message, type y and press Enter to proceed:
2

Name your app crossmint-embedded-checkout-demo and accept the default options

3

Change into the directory created in previous steps

4

Install @crossmint/client-sdk-react-ui

5

Open the project in your preferred code editor

1

Add environment variables

Create .env.local in your project root:
2

Create the checkout page

Replace your home page (e.g {root_dir}/app/page.tsx) with:
3

Run your app

Visit website (e.g http://localhost:3000) to see your checkout!
4

Test your app

Test purchases in staging using test credit cards, like 4242424242424242 (Visa). More information on testing can be found here.

Advanced Integration

Need purchase tracking, multiple NFT purchases at once, or more customization? Here’s a complete setup with additional features:
This advanced example showcases multiple items in one checkout, purchase status tracking, preferred payment methods and currencies, email-based delivery, and language settings. Learn more: Payment Methods · Select Items · Hooks & Events

Testing Your Integration

This demo uses the staging environment:

All Set!

You’ve successfully integrated card and crypto payments with the Crossmint Embedded Checkout!
Remember this demo is built on staging, so the digital assets will show up on the testnets. To launch on production, check the production checklist. You will need to contact Sales to enable the embedded checkout on production.

Next Steps

Appearance

Customize the look and feel of your checkout

Payment Methods

Configure available payment options for your users

Hooks & Events

Use React hooks to build custom checkout experiences

Localization

Set the checkout language and payment currency