Skip to main content

Setup Requirements

The Crossmint hooks must be used within components wrapped by both CrossmintProvider and CrossmintCheckoutProvider:

useCrossmintCheckout

The useCrossmintCheckout hook provides access to the checkout state and allows you to build custom UI experiences.

Return Values

PropertyTypeDescription
orderOrder | undefinedThe current order object containing all order details
orderClientSecretstring | undefinedThe client secret for the current order

Order Phases

The order can be in one of the following phases:
  • quote - Initial phase where price quotes are being generated
  • payment - Payment is being processed
  • delivery - NFTs are being delivered to the recipient
  • completed - Order has been successfully completed
For more information on the order lifecycle, see our Order Lifecycle guide.
Here's how you can use the order data to track the purchase progress:
For more information on the order object, see our Order Properties section.

Complete Example

Here’s a full example showing how to implement a custom checkout experience:

Best Practices

  1. Provider Setup: Always ensure components using hooks are wrapped with both required providers
  2. Error Handling: Handle undefined states when accessing order properties
  3. Loading States: Provide appropriate loading UI while the order state is initializing
  4. Type Safety: Take advantage of TypeScript support for better development experience

Migration from Previous Version

If you’re migrating from the previous version, note these key differences:
  • The event system has been replaced with the useCrossmintCheckout hook
  • Order status is now accessed through the hook instead of event listeners
  • Custom UI is built using React components instead of event handlers
  • Components must be wrapped with required providers
The new hook-based approach provides a more React-friendly experience and better TypeScript support compared to the previous event system.