
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.
Access the hook
Import and initializeuseFiatOnramp:
Start a fiat onramp flow
Callfund 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:
| Parameter | Type | Description |
|---|---|---|
source.assets | SupportedFiatCurrency[] | Optional. The list of fiat source currencies your app allows. Defaults to all supported currencies. When provided, must be non-empty. |
source.defaultAsset | SupportedFiatCurrency | Optional. The source currency selected when the flow opens. Falls back to the locale currency, then to the first item in source.assets. |
destination.asset | string | Required. Destination crypto asset for this flow (for example, 'usdc'). |
destination.chain | `${string}:${string}` | Required. Destination chain in CAIP-2 format. |
destination.address | string | Required. Destination wallet address for purchased funds. |
environment | 'sandbox' | 'production' | Optional. Onramp environment for provider APIs. |
defaultAmount | string | Optional. Initial fiat amount displayed in the amount step. |
Supported fiat currencies
SupportedFiatCurrency accepts any of the following lowercase ISO 4217 codes:
Full list of supported currencies
Full list of supported currencies
| Code | Currency |
|---|---|
usd | US Dollar |
eur | Euro |
gbp | British Pound |
mxn | Mexican Peso |
brl | Brazilian Real |
cny | Chinese Yuan |
jpy | Japanese Yen |
inr | Indian Rupee |
cad | Canadian Dollar |
krw | South Korean Won |
aud | Australian Dollar |
idr | Indonesian Rupiah |
sar | Saudi Riyal |
try | Turkish Lira |
chf | Swiss Franc |
twd | New Taiwan Dollar |
sek | Swedish Krona |
ngn | Nigerian Naira |
pln | Polish Zloty |
ars | Argentine Peso |
aed | UAE Dirham |
thb | Thai Baht |
zar | South African Rand |
dkk | Danish Krone |
egp | Egyptian Pound |
myr | Malaysian Ringgit |
sgd | Singapore Dollar |
cop | Colombian Peso |
php | Philippine Peso |
clp | Chilean Peso |
bdt | Bangladeshi Taka |
vnd | Vietnamese Dong |
czk | Czech Koruna |
ils | Israeli Shekel |
hkd | Hong Kong Dollar |
nzd | New Zealand Dollar |
pkr | Pakistani Rupee |
ron | Romanian Leu |
kzt | Kazakhstani Tenge |
nok | Norwegian Krone |
huf | Hungarian Forint |
uah | Ukrainian Hryvnia |
kwd | Kuwaiti Dinar |
qar | Qatari Riyal |
etb | Ethiopian Birr |
mad | Moroccan Dirham |
bgn | Bulgarian Lev |
kes | Kenyan Shilling |
npr | Nepalese Rupee |
Return value
fund returns a Promise with one of the following statuses:
| Status | Meaning |
|---|---|
'submitted' | The user completed the provider flow, then exited before final confirmation finished in Privy. |
'confirmed' | The flow reached provider confirmation, and the user completed the success step. |
Error handling
fund rejects on invalid configuration or incomplete flows. Common error cases include:
source.assetsis empty- another fiat onramp flow is already in progress
- the user closes the flow before submitting a purchase
- provider session or status requests fail
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 thedestination.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 and destination.chain to match the crypto asset and network that the deposit
address expects as input.
