Upgrade to V3
Learn how to migrate to the latest version, V3, of Crossmint’s Embedded Checkout
Overview
The latest version of Crossmint’s Embedded Checkout, Embedded V3, introduces a new architecture focused on simplicity and developer experience. Migrating your existing checkout integration is straightforward and can typically be completed in under 15 minutes. This guide will walk you through each step.
Which Version Am I Using?
Only two versions of Embedded Checkout exist, each using its own distinct component:
- V3: The new
<CrossmintEmbeddedCheckout />
component - V2: The legacy
<CrossmintPaymentElement />
component
The Embedded Checkout V3 component is available in @crossmint/client-sdk-react-ui@1.12.0
and above. Make sure to
update your dependencies to the latest version.
What’s New in V3?
Better DX
React hooks, TypeScript support, and simpler APIs
Multiple Items
Sell multiple NFTs in a single checkout with individual delivery tracking
Enhanced UI
More customization options and better payment method support
Key Changes
Embedded Checkout V3 introduces powerful new features focused on making your life easier:
- Simpler Developer Experience: More intuitive and idiomatic component API - less code, easier to understand
- Built-in Order Management: Complete order status UI out of the box - no more manual event handling (but fully customizable if needed)
- React Hooks for State Management: Replace event listeners with hooks for better control over the order lifecycle and checkout state
- Multi-Item Support: Sell multiple NFTs in a single checkout with individual delivery tracking for each item
- Better UI Customization: Includes more UI customization options - now you can control every aspect of the checkout’s appearance
- Advanced Cross-chain Support: Streamlined payment flows with expanded cross-chain capabilities
Component Renaming
The main checkout component has been renamed from CrossmintPaymentElement
to CrossmintEmbeddedCheckout
to better reflect its purpose and capabilities. This component now supports multiple line items, advanced payment methods, and enhanced UI customization.
Provider Architecture
The new Embedded Checkout V3 uses React Context providers to manage state and configuration. The CrossmintProvider
handles API authentication and environment setup using a client-side API key (more details in Step 1), while CrossmintCheckoutProvider
manages order state and checkout flow.
Property Updates
Key property changes in Embedded Checkout V3:
- Introduces new
lineItems
property for multi-item support - Uses
callData
object in each line item, replacing the previousmintConfig
property - Supports primary sales through
collectionLocator
with formatcrossmint:${collectionId}
or${chain}:${contractAddress}
- Supports secondary sales through
tokenLocator
with format${chain}:${contractAddress}:${tokenId}
- Replaces
uiConfig
withappearance
- see our UI Customization guide - Determines environment automatically from your API key
- Replaces event handlers with React hooks - see our Hooks guide
React Hooks for State Management
Events have been replaced with React hooks, providing better TypeScript support and a more intuitive development experience:
Multiple Line Items Support
Embedded Checkout V3 supports checking out multiple items (with different token IDs or collections) at once. Each line item has its own delivery status, allowing for granular tracking of each of the line items:
Secondary Sales Support
Embedded Checkout V3 introduces a cleaner way to handle secondary sales using the new tokenLocator
property:
When handling multiple items (e.g., marketplace or multi-item sales), each item has its own delivery status. If one item fails to deliver, others may still complete successfully. Make sure to handle each item’s status independently:
Orders API Integration
The new version integrates with our Orders API, enabling programmatic access to order status, history, and management. This allows you to build custom experiences and integrate with your backend systems.
Migration Steps
1. Get a Client API Key
Create a client-side API key with the orders.create
scope enabled. More info on creating API keys here.
2. Update Dependencies
1.12.0
or above.3. Update Import Statements
4. Update Environment Variables
Change your Crossmint environment variables (e.g. in your .env.local
file or Vercel configuration):
projectId
and environment
values are now automatically derived from the client-side API key.5. Update Component Structure
Instead of a single react component, <CrossmintPaymentElement />
, the new checkout now has
one provider, <CrossmintProvider />
that can be added in your layout page, or the same page you
have checkout on, and one react component, that has been renamed to <CrossmintEmbeddedCheckout />
.
The properties in the react component have changed:
projectId
andenvironment
are no longer needed- You now specify which items to buy using
lineItems
, an array of items that support bothcollectionLocator
(for primary sales with formats"crossmint:${collectionId}"
or${chain}:${contractAddress}
) andtokenLocator
(for secondary sales with the format${chain}:${contractAddress}:${tokenId}
). Each item includescallData
that takes the same object previously passed tomintConfig
Primary Sales
Secondary Sales
Advanced Features
Once you have the basic setup working, V3 now supports these additional features:
Payment Methods
Enable crypto and fiat payment options, and set preferred chains and currencies for your users. Learn more in our Payment Methods guide.
To enable Apple Pay, you’ll need to follow our Apple Pay setup guide. Apple Pay is now rendered directly on your site in V3, which requires domain verification through Apple.
UI Customization
Customize colors, typography, and component styles to match your brand. Learn more in our UI Customization guide.
Order Tracking
Embedded Checkout V3 now makes it easier to track order status using React hooks. Learn more in our React hooks guide.
Wrap your checkout component with CrossmintCheckoutProvider
and use the useCrossmintCheckout
hook:
Learn more about available hooks in our React hooks guide.
Complete Example
A complete example combining all features: