Overview
The latest version of Crossmint’s Pay Button, Pay Button V3, introduces a powerful new architecture focused on simplicity and developer experience. Migrating your existing Pay Button 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?
Pay Button has two versions - V2 and V3, each using its own distinct component:- V3: The new
<CrossmintHostedCheckout />
component with React Context providers - V2: The legacy
<CrossmintPayButton />
component
The Pay Button 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
Enhanced Multiple Items
Improved API for multiple NFTs with individual delivery tracking and better developer experience
Enhanced UI
More customization options and better payment method support
Key Changes
Pay Button V3 introduces several significant improvements and new capabilities:- 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
- Enhanced Multi-Item Support: Improved API for selling multiple NFTs with better 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 fromCrossmintPayButton
to CrossmintHostedCheckout
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 Pay Button V3 uses React Context providers to manage state and configuration. TheCrossmintProvider
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 Pay Button V3: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
- see our Item Selection guide for detailed examples - 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:Enhanced Multiple Line Items Support
While V2 supported multiple items throughquantity
parameters and mintConfig
arrays, Pay Button V3 introduces a more intuitive lineItems
approach for checking out multiple items at once from the same collection for primary sales. Each line item can have different quantities and prices, with individual delivery status tracking:
Migration Steps
1. Get a Client API Key
Create a client-side API key with theorders.create
scope enabled. More info on creating API keys here.
2. Update Dependencies
Upgrade the Crossmint React SDK to version
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):
The
projectId
and environment
values are now automatically derived from the client-side API key.5. Update Component Structure
Replace your V2 Pay Button with the new V3 component structure: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.UI Customization
Customize the appearance of your Pay Button and checkout experience. Learn more in our UI Customization guide.Pay Button V3 offers a streamlined appearance configuration focused on essential branding and display options. For
more advanced customization needs, consider using our Embedded Checkout solution.
Order Tracking
Pay Button V3 now makes it easier to track order status using React hooks. Learn more in our React hooks guide.Payment Configuration
Payment method configuration has been simplified in V3:Unlike Embedded Checkout, Pay Button V3 does not support configuring individual payment methods (like disabling
specific card types or wallets). All payment methods are enabled when you enable fiat or crypto payments.