Guides
Custom Payer
Learn how to integrate your own wallet solution with Crossmint’s embedded checkout
Overview
While Crossmint provides built-in wallet support, you can also integrate your own wallet solution using the payer
prop. This is useful when:
- You’re already using a wallet connection solution (like RainbowKit, Web3Modal, or ConnectKit)
- You want to customize the transaction signing flow
- You need to support specific wallets or chains
Quick Integration
Here’s a simple example using wagmi and viem:
When the user clicks the Pay Button, our SDK will first call handleChainSwitch
to ensure the correct network is
set, then handleSignAndSendTransaction
to complete the purchase.
Payer Configuration
The payer
prop accepts the following configuration:
Property | Type | Description |
---|---|---|
address | string | The wallet address of the payer |
initialChain | PayerSupportedBlockchains | The initial blockchain (e.g. “polygon”, “ethereum”, “base-sepolia”) |
supportedChains | PayerSupportedBlockchains[] | Optional list of supported chains. Defaults to initialChain if not specified |
handleChainSwitch | (chain: PayerSupportedBlockchains) => Promise<void> | Function to handle chain switching |
handleSignAndSendTransaction | (serializedTx: string) => Promise<TransactionResponse> | Function to handle transaction signing and sending, where TransactionResponse is either { success: true, txId: string } or { success: false, errorMessage: string } |
Popular Wallet Solutions
You can integrate Crossmint with popular Web3 solutions:
RainbowKit
Web3Modal
Best Practices
- Error Handling: Always return clear error messages in
handleSignAndSendTransaction
- Chain Support: Be explicit about supported chains to avoid runtime errors
- User Experience: Show loading states during chain switches and transactions
- Wallet Connection: Ensure wallet is connected before showing checkout