Before going live, you’re required to complete KYB verification via the dashboard. Alternatively, get a link from your MP Account Manager.Note: KYB is not required to start the integration process.
1. Create your Deposit
Create a deposit via the Create Deposit endpoint or the dashboard. Upon creation, adepositId will be returned. Configure the following options:
- Deposit Name: Assign a unique name to the deposit. Within this section, you can:
- Recipient Currency: Specify the blockchain/currency in which you wish to receive fund
-
Payment Options: Enable Transfer Manually, Connect Wallet and Add Money.
The Add Money option (card, Apple Pay, etc.) requires MoonPay Ramps to be enabled.
- Set up MoonPay and obtain your API keys via the Ramps documentation
- Add your MoonPay keys in the MoonPay Commerce Dashboard (Settings → Integrations → MoonPay Ramps). For questions, contact support@moonpay.com
- Customisation: Update badges and CTA (Call to Action) copy
- Notifications: Enable email notifications to receive updates when a deposit is successfully completed.
2. Create a Deposit Customer
Generate a Deposit Customer via the API and their associated deposit addresses across SVM, EVM, and BTC networks.- Required Parameters: To create a customer, you must specify a unique
customerId, arecipientWallet, and any optional metadata via theadditionalJsonpayload. - Save the token: Store the returned Deposit Customer token. This token allows you to reuse the same deposit address for subsequent transactions from the same customer.
- Related endpoints: use the Update Deposit Customer and Get Deposit Customer endpoints as needed.
- Test Customer Deposit Session: In this step you can simulate a deposit widget. You must define a
customerIdand arecipientWalletto generate the test environment.
3. Build Your Own or Serve our Deposit UI in Your App
Headless support
- Serve deposit addresses in your own UI. Create and store the
depositCustomerToken-> use the Get Deposit Customer endpoint to get thedepositWalletsarray - Use the Record Wallet Activity endpoint whenever you display a deposit wallet to a customer. This increases balance polling and detect incoming payments more quickly
- Use Get Deposit Currencies to check available currencies
Deposit Widget Setup
Embed the deposit widget in your app using the following NPM package . The below configuration options are available for customising your deposit widget via config:Use our demo environment to test display and other configurations. Simply toggle to the Deposit view and paste the Deposit Customer token.
display
Controls how the deposit flow is rendered on your page.
- Type:
'inline' | 'button' | 'new-tab' - Default:
'inline' - Required: No
'inline'- Embeds the deposit flow directly in the container element'button'- Renders a button that opens the deposit flow in a modal'new-tab'- Renders a button that opens the deposit flow in a new browser tab
If you enable Add Money and use the deposit widget in inline or button mode, your domain(s) must be whitelisted by MoonPay Ramps. In some cases, this may require additional KYB. You can always use new-tab mode without domain whitelisting, or disable the Pay with Cash option.
network
Specifies the environment for the deposit flow.
- Type:
'test' | 'main' - Default:
'main' - Required: No
'test'- Use the test/sandbox environment for development and testing'main'- Use the production environment for live transactions
themeMode
Specifies the default light/dark mode. Alternatively you can also set a fixed Company Theme (Settings -> Merchant settings) that overrides this config.
- Type:
'dark' | 'light' - Default:
'undefined' - Required: No
'dark'- The widget uses dark mode'light'-The widget uses light mode
If
themeMode is undefined and no Company Theme is set, the deposit flow will automatically match the user’s system light/dark mode.variant
Minimal removes padding and background for inline embeds
- Type:
'default' | 'minimal' - Default:
default - Required: no
'default'– Standard embed with padding and background'minimal'– Removes padding and background for inline embeds
openWalletConnectInNewTab
Controls whether the WalletConnect flow opens in a new browser tab.
- Type: boolean
- Default: false
- Required: No
true– WalletConnect opens in a new browser tabfalse– WalletConnect opens in the current tab or modal
Note: For better UX, consider setting this conditionally (e.g.
openWalletConnectInNewTab={wallet.isConnected}) so a new tab is only opened when needed.forcedStep
Forces the deposit flow to begin at a specific step, skipping any preceding steps in the default deposit journey.
- Type: ‘connect-wallet’ | ‘wallet-display’ | ‘moonpay-onramp’
- Default: undefined
- Required: No
'connect-wallet' — Forces the flow to start at the Connect Wallet step.
'wallet-display' — Forces the flow to start at the Wallet Display step.
'moonpay-onramp' — Forces the flow to start directly at the MoonPay Onramp step.
currentlyConnectedWallet
Allows the host application to pass an already connected user wallet into the deposit flow, surfacing it as an additional selectable option.
- Type: ConnectWalletSelection
- Default: undefined
- Required: No
wallet— The connected wallet provider.blockchain— The chain the wallet address belongs to.address— The connected wallet address.
wallet values (DepositConnectWallet)
'METAMASK','PHANTOM','TRUST_WALLET','WALLET_CONNECT'
blockchain values
'SOL','ETH','BASE','POLYGON','ARBITRUM','BSC','ABSTRACT','HYPERLIQUID'
Embedding the widget inside a React app
Embed the deposit widget in your React application using the Deposit Widget on npm.Optional: Preload Assets with the Provider
To improve load performance, you can optionally wrap your application with theMoonpayCommerceDepositProvider.
The provider preloads the required JavaScript assets ahead of time, so when <MoonpayCommerceDeposit /> renders, it does not need to wait for the scripts to load.
Import
layout.tsx or _app.tsx):
childrenshould include the rest of your application, including any usage of<MoonpayCommerceDeposit />.- This setup is optional. If you do not use the provider, assets will still load automatically when
<MoonpayCommerceDeposit />is rendered.
src URL with your own token returned when creating the customer deposit via the API (e.g. acac3ec9-f8f6-4128-8159-a91e418e2581) to render the correct deposit widget.
Iframe Post Message Events
Our deposit widget emits structured postMessage events that let your application react instantly to lifecycle changes such as completion, errors, or height updates, keeping your interface responsive and in sync without requiring a page reload.
| Event | Payload | When it fires |
|---|---|---|
| onSuccess | {} (empty object) | Deposit flow completed and the merchant has been successfully paid. |
| onError | { message: string } | Something went wrong |
| onHeightChanged | { height: number } (pixels) | The widget needs a new height (e.g. after a step change) |
| onReady | {} (empty object) | Widget has fully initialised and is ready |
Always validate the
event.origin before handling messages from the widget. This ensures you only process events coming from our domain and ignore anything unexpected.