Swaps & Payments
Cross-chain swaps, fiat onramp, direct transfers
Checkout
Cart, order summary, forms, shipping, discounts
Deposits
Chain selection, custom contracts, QR codes
Core components
<AnySpend>
The primary interface component for token-to-token exchanges, fiat onramps, and cross-chain swaps.
Basic Usage
Props
'modal' | 'page'
default:"'modal'"
Display as modal overlay or full page
'crypto' | 'fiat'
default:"'crypto'"
Initial payment method tab
string
Target token contract address
number
Chain ID of destination token
string
Recipient wallet address
number
Pre-select the source chain
string
Load and display an existing order by ID
boolean
default:"false"
Hide the transaction history button
boolean
Hide the component header
Hide the bottom navigation bar
(token: Token, event: { preventDefault: () => void }) => void
Called when a token is selected. Call
event.preventDefault() to prevent default token selection behavior.(txHash?: string) => void
Callback fired on successful transaction
string[]
Custom fiat input presets (e.g.,
["10", "25", "50", "100"])boolean
Disable URL parameter syncing for swap configuration
boolean
Enable direct transfers when source and destination token/chain match (skips the swap backend)
string
Fixed destination amount in wei. When set, users cannot change the amount.
string
Pre-fill sender address to show token balances before wallet connection
Record<string, unknown>
Opaque metadata passed through to order callbacks (e.g., workflow form data)
string
URL to redirect to from the “Return to Home” button on the completion screen
string
Custom label for the recipient display (e.g., “OBSN Telegram Bot”)
string
Custom label for the return home button
AnySpendClasses
CSS class overrides for specific elements. See Customization.
AnySpendSlots
Render function overrides for replaceable UI elements. See Customization.
AnySpendContent
Text/message overrides for success, error, and processing states. See Customization.
AnySpendTheme
Color and theme configuration. See Customization.
Usage examples
- Basic Swap
- Fiat Onramp
- Fixed Amount
- Custom Branding
<AnySpendDeposit>
A streamlined deposit interface supporting chain selection, crypto/fiat payments, and custom contract deposits.
Basic Usage
Props
string
required
The wallet address to receive the deposit
string
required
Destination token contract address
number
required
Destination chain ID
'modal' | 'page'
default:"'modal'"
Display mode
'crypto' | 'fiat'
Force a payment type. If not set, shows chain selection first.
string
Pre-select the source token
number
Pre-select the source chain. If not provided, shows chain selection step.
string
Load an existing order by ID
(amount: string) => void
Callback when deposit completes successfully
() => void
Callback when the close button is clicked
(token: Token, event: { preventDefault: () => void }) => void
Called on token selection. Call
event.preventDefault() to override default behavior.() => void
Callback for opening a custom modal (e.g., for special token handling)
'hype_duel' | 'custom_exact_in' | 'swap'
default:"'swap'"
Order type for the deposit
DepositContractConfig
Configuration for depositing to a custom smart contract. Creates a
custom_exact_in order that calls the specified contract.boolean
Allow direct transfers when source and destination match
string
Fixed destination amount in wei
number
Minimum destination amount required
boolean
Prefer using connected EOA wallet
boolean
Show chain selection step. Defaults to
true if sourceTokenChainId is not provided.ChainConfig[]
Custom list of supported chains for chain selection
number
default:"3"
Number of top chains to show in chain selection
string
Custom title for the chain selection step
string
Custom description for the chain selection step
number
default:"1000000"
Minimum pool size for filtering tokens
string[]
Custom fiat input presets
string
Custom label for the action button
(props: { anyspendPrice, isLoadingAnyspendPrice }) => JSX.Element
Custom header component
Custom footer content
string
Redirect URL for the “Return to Home” button
string
Custom label for recipient display
string
Custom label for the return button
string
Pre-fill sender address for token balance display
Record<string, unknown>
Metadata passed through to order callbacks
boolean
default:"false"
When true, uses
AnySpendCustomExactIn for custom function depositsAnySpendAllClasses
CSS class overrides. See Customization.
AnySpendSlots
Render function overrides. See Customization.
AnySpendContent
Text/message overrides. See Customization.
AnySpendTheme
Theme configuration. See Customization.
DepositContractConfig
Use this to configure custom contract deposits:Type Definition
ChainConfig
Type Definition
Usage examples
- Basic Deposit
- Custom Contract Deposit
- With Chain Selection
<AnySpendCheckout>
A full-featured checkout component with cart display, order summary, custom forms, shipping selection, discount codes, and multi-payment-method support.
Basic Usage
Props
string
required
Payment recipient wallet address
string
required
Destination token contract address
number
required
Destination chain ID
CheckoutItem[]
required
Line items to display in the cart
'page' | 'embedded'
default:"'page'"
Display mode
string
Override the computed total (in wei). Useful when the total differs from the sum of item amounts.
string
Merchant/organization name displayed in the checkout header
string
URL for the organization logo
string
Hex color for theming the checkout (e.g.,
"#6366f1")string
Custom text for the payment button
string
Link this checkout to a checkout session for backend tracking
(result: { txHash?: string; orderId?: string }) => void
Called on successful payment
(error: Error) => void
Called on payment error
string
URL to redirect to after payment
string
Label for the return button
PaymentMethod
Which payment method to expand initially
string
Pre-fill sender address for token balance display
Custom footer for the order summary. Pass
null to hide the default footer.boolean
default:"false"
Show points earned in the order status summary
boolean
default:"false"
Show the order ID in the order status summary
string | { amount: string; label?: string }
Shipping cost. String = amount in wei. Object = amount with custom label.
string | { amount: string; label?: string; rate?: string }
Tax amount. String = amount in wei. Object = amount with custom label and optional rate display.
string | { amount: string; label?: string; code?: string }
Discount amount (displayed as negative). String = amount in wei. Object = amount with label and optional code.
CheckoutSummaryLine[]
Additional summary line items (e.g., platform fees, tips, service charges)
CheckoutFormSchema
JSON schema for collecting customer info. See Checkout Guide.
React.ComponentType<CheckoutFormComponentProps>
Custom React form component. See Checkout Guide.
(data: Record<string, unknown>) => void
Called when form data changes
ShippingOption[]
Shipping options displayed as a selector. See Checkout Guide.
boolean
Show a shipping address form
(option: ShippingOption) => void
Called when shipping option changes
boolean
Show a discount code input
(code: string) => Promise<DiscountResult>
Async discount code validation function
(result: DiscountResult) => void
Called when a discount is applied
AnySpendCheckoutClasses
CSS class overrides. See Customization.
AnySpendSlots
Render function overrides. See Customization.
AnySpendContent
Text/message overrides. See Customization.
AnySpendTheme
Theme configuration. See Customization.
CheckoutItem
Type Definition
CheckoutSummaryLine
Type Definition
<AnySpendCheckoutTrigger>
Extends AnySpendCheckout with B3 workflow integration. Automatically triggers a workflow on successful payment.
Basic Usage
Additional Props (beyond AnySpendCheckout)
string
B3 workflow ID to trigger on successful payment
string
Organization ID that owns the workflow
object
Metadata merged into the order for workflow access. The
inputs field is accessible via {{root.result.inputs.*}} in workflows.With Workflow & Metadata
<AnySpendWorkflowTrigger>
A payment component designed specifically for triggering B3 workflows. Requires a fixed payment amount and workflow configuration.
Basic Usage
Props
string
required
Payment recipient address
number
required
Destination chain ID
string
required
Destination token address
string
required
Required payment amount in wei
string
required
B3 workflow ID to trigger
string
required
Organization ID that owns the workflow
object
Metadata for workflow access.
inputs are accessible via {{root.result.inputs.*}}.(amount: string) => void
Callback when payment succeeds
() => void
Callback when the component is closed
'modal' | 'page'
Display mode
string
Custom label for the action button (e.g., “Pay & Activate”)
AnySpendAllClasses
CSS class overrides
<QRDeposit>
A QR code-based deposit interface that generates a deposit address for users to send funds to.
Basic Usage
Props
string
required
The wallet address to receive the deposit
Token
required
The destination token to receive
number
required
The destination chain ID
'modal' | 'page'
Display mode
Token
Source token to deposit (defaults to ETH on Base)
number
Source chain ID (defaults to Base)
string
Creator address for order tracking
DepositContractConfig
Custom contract execution after deposit
() => void
Callback when back button is clicked
() => void
Callback when close button is clicked
(orderId: string) => void
Callback when the deposit order is created
(txHash?: string) => void
Callback when deposit is completed
QRDepositClasses
CSS class overrides
Specialized components
<AnySpendNFTButton>
A streamlined button for NFT purchases with built-in payment handling.
NFT Purchase Button
Props
NFTContract
required
NFT contract configuration object
string
required
Wallet address to receive the NFT
NFTContract Interface
Type Definition
<AnySpendCustom>
Flexible component for custom smart contract interactions, including staking, gaming, and DeFi operations.
Custom Contract Interaction
Props
'custom'
required
Order type identifier
number
required
Target blockchain network
Token
required
Token used for payment
string
required
Amount in wei
string
required
Target smart contract address
string
required
Encoded function call data
string
Token spender address
object
Custom metadata for tracking
React.ComponentType
Custom header component
(txHash?: string) => void
Success callback
<AnySpendNFT>
Enhanced NFT purchase component with marketplace features.
Enhanced NFT Component
<AnySpendStakeB3>
Pre-configured component for B3 token staking.
B3 Staking
<AnySpendBuySpin>
Gaming-specific component for purchasing spin wheel or lottery entries.
Spin Wheel Purchase
<AnySpendTournament>
Tournament entry payment component.
Tournament Entry
<AnySpendBondKit>
BondKit integration for bonding curve token purchases.
BondKit Purchase
Providers
<AnyspendProvider>
Required provider that wraps all AnySpend components. Manages query client, Stripe redirect handling, and feature flags.
Provider Setup
Props
ReactNode
required
Child components
FeatureFlags
Optional feature flag overrides
Payment method types
Payment Method Enums
Next steps
Customization
Customize slots, content, theme, and CSS classes
Checkout Guide
Build checkout experiences with order summaries
Hooks Reference
React hooks for custom payment flows
HypeDuel