Skip to main content

Recommended: JavaScript SDK with React Hooks

For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.

Summary

This hook can be used to trigger an Onramp UI so that users can immediately buy crypto with fiat.

How it works

After setting up your onramp provider, you can use the useOnramp to prompt your user to fund their wallet.
For other funding methods, see usePayWithDynamic for unified payment flow.
The following attributes are exposed:

Example

Custom onramp button:

Example with Crypto.com

Crypto.com is currently in limited beta. Please contact support if you’re interested in early access.

Example with MoonPay

Opening MoonPay navigates the Dynamic widget to a token selector screen where the user picks a supported token before being forwarded to MoonPay’s hosted checkout. For a fully headless integration outside the widget, see the MoonPay guide.

Getting QR Codes for Onramp

You can retrieve QR codes for supported onramp providers using the getOnrampQrCode method:

Accessing Provider Information

You can access available onramp providers and their configuration for custom UI implementations:

Provider Object Structure

Each provider in the providers array contains:
Last modified on June 25, 2026