- Embed a
paylinkIdas a Checkout Widget in your application for a seamless payment experience. Explore the configurations below - Embed a
depositIdas a Deposit Widget in your app. Learn more about deposit widget configuration options
Get started
- Log into MoonPay Commerce to setup your
paylinkIdand generate the code snippet on the final step of our payment creation flow. Use https://demo.hel.io/ to customise your theme & config - Our standard way to embed our checkout is with our JS/HTML embed - simply paste into your code builder as follows
- If you want to set the price in your widget programmatically, set the price to
dynamicin the dashboard and pass theamount
MoonPay Commerce Checkout (React)
If you have a React based app, then the easiest way to embed MoonPay Commerce Checkout is with our React component. Install the dependency:useMemo()
Config Options
The configuration options object is the same for our Vanilla JS and React version.Common config options:
- One of the following must be set (but not both)
paylinkId- This is the ID for the Pay Link you would like to embed
- **example: **
paylinkId: "6571e7cd4a2bee1095ee84da"
- **example: **
- This is the ID for the Pay Link you would like to embed
chargeToken- A charge token (you can create charges via our API).
- example:
chargeToken: "05adc323-0450-4ef8-b127-18949b9ff485"
- example:
- A charge token (you can create charges via our API).
network(optional - default ismain)- values:
mainortest - example:
network: "test" - This is only required if you generated a Pay Link on our dev/testnet site
https://app.dev.hel.io/ - See note below how our
networkvalue works.
- values:
paymentType(optional - default ispaylink)- values:
paylinkorpaystream - example: paymentType: “paystream”
- This is only required if you set up a recurring paystream embed.
- If your Pay Link is recurring, the code snippet on step 4 will already include
paymentType: "paystream"
- values:
platformonly if you are embedding from presale.magiceden.io- If you are embedding our checkout for a Pay link created from moonpay.hel.io you should not set this value.
- values:
magic_eden - example: platform:
magic_eden
Customising the look of the embed:
display(optional - default isinline)- values:
buttoninlineornew-tab - example:
display: "button"Use this to display a button that opens up a modal with our checkout flow example:display: "new-tab" Use this to display a button that opens up a unique, single use checkout page in a new tab. The "charge pages" are optimal for mobile payment flows, deep-linking, QR codes, embedded pay buttons on simple websites like Wix, or other custom payment flows. Learn more about Charges
- values:
primaryPaymentMethod(optional - default iscrypto)- values:
cryptoorfiat - example:
primaryPaymentMethod: "fiat" If set tofiat, then 'pay with card' will be the default button option.
- values:
customTexts(optional)- Use this to override some texts/copy within the embed.
- Current options are as follows:
theme(optional)
themeMode((use this to switch between light or dark appearances):- values:
lightordark
primaryColor(optional, required whenneutralColoris defined)- Use this to customise main colours within the embed
neutralColor(optional, required whenprimaryColoris defined)- Use this to customise neutral colours such as border and text colours within the embed
backgroundColor(optional, use this to change the background color)- values: Provide a
hex code(e.g., #FFFFFF for white or #000000 for black)
- values: Provide a
- showPayWithCard (optional - default is
true)- Use this to remove the ‘Pay with card’ button from the embed.
- values:
trueorfalse
Dynamic config options
If you have a dynamic payment (to programatically set the amount a) then you will need to use these options:- Log in to MoonPay Commerce and select CREATE PAYMENT -> Dynamic pricing -> paylinkId
amount(required for dynamic payments)- values: a string value
- example:
amount: "5.99" - This will be the amount of the payment currency
- Use step 2 of the Pay link creation process on moonpay.hel.io to set the currencies you will receive in.
Autofill config options
Use theautofillConfig option to pre-populate customer and shipping fields in the checkout form.
All fields are optional strings.
Customer details:
fullName— customer’s full nameemail— customer’s email addressphoneNumber— phone numberareaCode— phone area/country code
deliveryAddress— full delivery address (freeform)street— street namestreetNumber— street/house numbercity— citystate— state or regioncountry— ISO 3166-1 alpha-2 country code (e.g."US","GB")areaCode— postal/area code
productValue— pre-fill the product valueadditionalProductValue— additional product value
discordUsername— Discord usernametelegramUsername— Telegram usernametwitterUsername— Twitter/X username
Callback config options
Use our callbacks to run Javascript code when certain actions occur. You can use these to trigger changes in your application.onSuccessonErroronPendingonCancelonStartPayment
Advanced Config Options:
debug(optional - default isfalse)trueorfalse- example:
debug: true - if true then it will output some helpful debug information
AdditionalJSON
additionalJSON(optional)- values can be any valid JSON data.
- example:
additionalJSON: {customerId: "customer1", product: "T-shirt"} - Anything you pass in here will get stored when a customer makes a transaction.
- You can retrieve this on transactions by listening for our webhooks, which include all relevant values
IMPORTANT: Phantom requires domain allowlisting for the checkout widget to avoid transaction safety warnings. Fill this form for allowlisting.
Our Network Options for Testnet
When you generate a Pay Link on app.dev.hel.io (for test transactions), then you must setnetwork: "test" in your config.
If you generate your Pay moonpay.hel.io (mainnet) you do not need to set
network config options!network: "test" for a Pay Link generated on moonpay.hel.io)
The testnets that we use for each blockchain are described below:
- Solana:
main= mainnettest= devnet
- Ethereum
main= mainnettest= Sepolia
- Polygon
main= mainnettest= Mumbai
- Bitcoin
main= mainnettest= testnet3
- Base
main= Mainnettest= Sepolia
