With this integration, one can use a credit card to purchase tokens across many different networks.

Integration

To integrate the on-ramp feature, follow these steps:

1

Connect with Web SDK

Make sure you completed the Getting Started guide.

2

1. Install the @0xsequence/checkout library

npm install @0xsequence/checkout
# or
pnpm install @0xsequence/checkout
# or
yarn add @0xsequence/checkout
3

2. Place the `SequenceCheckoutProvider` Below the `SequenceConnect` Provider in your App:

import { SequenceCheckoutProvider } from '@0xsequence/checkout'
import { SequenceConnect } from '@0xsequence/connect'
import { config } from './config'

const App = () => {
  return (
    <SequenceConnect config={config}>
      <SequenceCheckoutProvider>
        <Page />
      </SequenceCheckoutProvider>
    </SequenceConnect>
  )
}
4

3. Adding Funds with a Credit Card

Call the triggerAddFunds function to cause a modal to appear

import { useAddFundsModal } from '@0xsequence/checkout'
  import { useAccount } from 'wagmi'

  const MyComponent = () => {
    const { address: recipientAddress } = useAccount()
    const { triggerAddFunds: toggleAddFunds } = useAddFundsModal()

    const onClick = () => {
      toggleAddFunds({
        walletAddress: recipientAddress,
      })
    }

    return (
      <button onClick={onClick}>Add Funds</button>
    )
  }

Congratulations! You’ve just learned how to add funds to your wallet using Web SDK.

Configuration Overview

The following is the available configuration customization options for toggleAddFunds params

interface AddFundsSettings {
  walletAddress: string | Hex // Address of the wallet where funds will be added
  fiatAmount?: string // Specify the amount in fiat to add
  fiatCurrency?: string // Specify the fiat currency (e.g., USD, EUR)
  defaultFiatAmount?: string // Default amount in fiat to add
  defaultCryptoCurrency?: string // Default cryptocurrency to use (e.g., ETH, BTC)
  cryptoCurrencyList?: string // List of cryptocurrencies available for selection. Example: "USDT,BTC,USDC"
  networks?: string // Specify network(s) to use for the transaction. Example: "mainnet,ethereum"
  onClose?: () => void // Callback function to execute when the modal is closed
}