Skip to main content

Overview

An on-ramp lets a user buy USDC with a card or bank transfer. Dynamic generates a signed, hosted URL for a provider — you open it, and the provider handles KYC, payment, and delivery straight to the user’s wallet address. You never handle provider credentials or payment details. The JavaScript SDK is headless, so there is no built-in deposit button. You call one function to get the URL and render the entry point yourself, which means you can lock the flow to USDC up front instead of letting the user pick an asset.

Prerequisites

Buy USDC with Coinbase

getCoinbaseBuyUrl returns { url } for the hosted Coinbase Onramp widget. Pass defaultAsset: "USDC" and the networks you accept USDC on, so the user lands on a USDC purchase rather than a generic asset picker.

Buy USDC with MoonPay

getMoonPayUrl returns a signed MoonPay widget URL. Set token: 'USDC' to lock the widget to USDC, and networkId to pin the chain it is delivered on.
Not every provider supports USDC on every chain. Call getMoonPayCurrencies for a chain before you show the entry point, and hide it when USDC isn’t available. MoonPay currency codes are chain-suffixed, so check for the network-specific code — usdc_base on Base, not a bare usdc.

Pre-fill an amount

Both providers accept a starting amount, which is useful when you already know what the user needs to top up — for example to cover a pending payment.

Reflect the new balance

Delivery is asynchronous. The provider credits the wallet after the user finishes payment and KYC in the hosted widget, which can be minutes later and may happen after the user has closed the tab. Refresh USDC balances when the user returns to your app rather than immediately after opening the URL. For an embedded Coinbase flow with real-time order events instead of a popup, use createCoinbaseOnrampOrder.

Handling errors

Last modified on November 17, 2026