Skip to main content
Fiat Onramp
Privy provides a useFiatOnramp hook in @privy-io/react-auth that starts a fiat onramp flow in the Privy modal.Your app can use this hook to let authenticated users buy crypto with supported fiat currencies, such as USD and EUR. Privy routes purchases through supported providers — Stripe, Meld, MoonPay, and Coinbase — based on availability and user region.

Access the hook

Import and initialize useFiatOnramp:

Start a fiat onramp flow

Call fund with source currency options, and a destination wallet.
destination.chain accepts a CAIP-2 identifier (for example, eip155:8453 for Base or solana:mainnet for Solana).

Parameters

fund accepts an object with the following fields:

Supported fiat currencies

SupportedFiatCurrency accepts any of the following lowercase ISO 4217 codes. Reach out to [email protected] to request support for additional currencies.

Return value

fund returns a Promise with one of the following statuses:

Error handling

fund rejects on invalid configuration or incomplete flows. Common error cases include:
  • source.assets is empty
  • another fiat onramp flow is already in progress
  • the user closes the flow before submitting a purchase
  • provider session or status requests fail
Your app should wrap calls in try/catch and show clear UI feedback.

Complete example

Use with deposit addresses

Apps that already use deposit addresses to receive funds on behalf of users can pass that address directly as the destination.address in the fund call. The onramp flow purchases the specified crypto asset and delivers it straight to the deposit address, letting your app credit the user’s account through your existing settlement logic.
The destination.address does not need to be the user’s own wallet. It can be any valid address your app controls, such as a per-user deposit address generated by your backend. Set destination.asset to the token address and destination.chain to the network that the deposit address expects as input.

Stripe Embedded Components onramp

Privy supports Stripe’s Embedded Components for Crypto Onramp as a payment option within the fiat onramp flow. Stripe provides an embedded UX that handles payment processing, KYC via Link, and crypto delivery directly to the user’s wallet.
Requires @privy-io/react-auth version 3.33.1 or later.
Install the @stripe/crypto package as a required dependency:
Supported payment methods include credit, debit, Apple Pay, Google Pay, and ACH (US only). Supported destination currencies include USDC (Base, Solana, Ethereum, and Arbitrum). Available in the US (excluding New York). EU support coming soon.

Stripe docs

Official Stripe Embedded Components onramp documentation