Guides
React Hooks
Learn how to use React hooks to control and customize your Pay Button Checkout experience
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
Property | Type | Description |
---|---|---|
order | Order | undefined | The current order object containing all order details |
orderClientSecret | string | undefined | The 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 generatedpayment
- Payment is being processeddelivery
- NFTs are being delivered to the recipientcompleted
- 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
- Provider Setup: Always ensure components using hooks are wrapped with both required providers
- Error Handling: Handle undefined states when accessing
order
properties - Loading States: Provide appropriate loading UI while the order state is initializing
- Type Safety: Take advantage of TypeScript support for better development experience