getMoonPayWidgetUrl()
Generates a URL to be loaded in an iframe to use the MoonPay checkout flow
Parameters
Name | Type | Required | Description |
---|---|---|---|
tokenID | Number | Y | The token ID for which the widget is being retrieved |
walletAddress | String | N | Wallet 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.
Updated 8 months ago