Overview
Pay mode implements exact-output trade flows where you specify the precise amount the recipient receives. The widget calculates the required input amount from the user’s available tokens across all chains. Trade Type:EXACT_OUTPUT - Fixed destination amount, variable input amount.
Configuration
Required Props
| Prop | Type | Description |
|---|---|---|
mode | "pay" | Sets the widget to pay mode |
toAddress | string | Recipient address |
toAmount | string | Exact amount recipient receives |
toChainId | number | Destination chain ID |
toToken | string | Destination token symbol or address |
Optional Props
| Prop | Type | Description |
|---|---|---|
toCalldata | string | Calldata to execute on destination |
slippageTolerance | string | number | Slippage tolerance (e.g., "0.005" for 0.5%) |
quoteProvider | QuoteProvider | Specific quote provider: "auto" | "lifi" | "relay" | "cctp" |
Implementation
Basic Payment
Simple payment to a recipient address:Payment with Contract Call
Execute a function call on the destination chain with the payment:Payment with Custom Quote Provider
Specify a particular quote provider for routing:Event Handlers
Handle payment lifecycle events:Use Cases
- NFT Purchases: Mint or purchase NFTs with payment in one transaction
- eCommerce Payments: Accept crypto payments for products/services
- Fixed-price Swaps: Cross-chain token purchases with exact output amounts
- Contract Execution: Call smart contract functions with attached payment
- x402 Payments: HTTP 402 payment flows with any token from any chain
See Also
- Use Case Examples - Detailed implementation patterns
- Configuration Reference - Full configuration options
- Quote Providers - Quote provider details