Skip to main content
Privy provides a useAddFunds hook in @privy-io/react-auth that opens a unified funding flow in the Privy modal. Your app can use this hook to let authenticated users fund a destination wallet with fiat, crypto, or both. When both methods are configured, Privy shows a method picker before starting the selected flow. When only one method is configured, Privy starts that flow directly.

Prerequisites

Enable the funding methods your app supports on the Account Funding page in the Privy Dashboard. See the configuration guide for details.

Access the hook

Import and initialize useAddFunds:

Start a unified funding flow

Call addFunds with a destination wallet and at least one funding method config.
destination.chain accepts a CAIP-2 identifier (for example, eip155:8453 for Base or solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp for Solana mainnet). destination.asset is the token address on that destination chain.

Parameters

addFunds accepts an object with the following fields: At least one of fiat or crypto must be provided. Provide both to show the method picker.

Return value

addFunds returns a Promise with one of the following results:

Error handling

addFunds rejects on invalid configuration or incomplete flows. Common error cases include:
  • destination.address, destination.chain, or destination.asset is missing
  • neither fiat nor crypto is provided
  • fiat.source.assets is empty
  • the user is not authenticated
  • another add funds flow is already in progress
  • the user cancels the flow
  • provider session, quote, or deposit address requests fail
Your app should wrap calls in try/catch and show clear UI feedback.

Complete example

Fiat-to-crypto onramps

Fund wallets with fiat via card, Apple Pay, or Google Pay.

Crypto deposit addresses

Fund wallets by letting users transfer crypto from another wallet.