getMoonPayWidgetUrl()

Generates a URL to be loaded in an iframe to use the MoonPay checkout flow

Parameters

NameTypeRequiredDescription
tokenIDNumberYThe token ID for which the widget is being retrieved
walletAddressStringNWallet Address to include in the signature of the widget

📘

If a walletAddress is provided, it will be included in the signature and returned back to you in the final widgetUrl. Please do not append a wallet

Response

string

Example Usage

const tokenId = 1;

const moonPayUrl = await contract.getMoonPayWidgetUrl(tokenId, walletAddress);

console.log(moonPayUrl);
// https://buy.moonpay.com/nft
// ?dynamicAssetInfo=true
// &apiKey=pk_test_123
// &contractAddress=0x123
// &tokenId=0
// &walletAddress=0x12345
// &signature=zzSIG

Notes

The signature returned is required for production and optional for testing. However if you provide a signature when testing it will be validated. Please do not not append any additional url parameters to the Url once generated as it will cause the signature validation to fail.

Feedback

Something not quite right, unclear or can't find what you are looking for? Please let us know at support.moonpay.com and we will get back to you as soon as we can.