Skip to main content

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 dashboard.

Usage

Parameters

Returns

Promise<string> - A promise that resolves to the signed MoonPay URL.

Examples

Open in a popup window

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 dashboard.
  • The requested chain and token must be supported by MoonPay. Use getMoonPayCurrencies to discover supported tokens.

React

useGetMoonPayUrl is a mutation hook — call mutate to generate a URL on demand:
Last modified on June 29, 2026