getMoonPayUrl
Returns a signed MoonPay URL for funding a wallet with a fiat-to-crypto purchase. Open the returned URL in a new tab or popup to let the user complete the purchase on MoonPay’s hosted widget.
The URL is generated through Dynamic’s onramp API and is pre-signed for your environment, so you don’t need to handle MoonPay credentials directly. Requires a MoonPay onramp to be enabled and configured for your environment in the Dynamic developer console.
Usage
Parameters
Returns
Promise<string> - A promise that resolves to the signed MoonPay URL.
Examples
Pre-fill a purchase amount
Lock the widget to a specific token and pre-fill the fiat amount the user will spend:
Handle errors
Errors
Prerequisites
- MoonPay must be enabled and configured as an onramp provider for your environment in the Dynamic developer console.
- The requested
chain and token must be supported by MoonPay. Use getMoonPayCurrencies to discover supported tokens.
React
useGetMoonPayUrl is a query hook: it fetches the widget URL for the parameters you pass and returns it in data.
Last modified on September 16, 2026