MoonPay is highly committed to security. For this reason, whenever sensitive information such as emails or wallet addresses are transmitted to the widget, you are required to use the parameter, otherwise, the MoonPay widget . This measure makes it more difficult for unauthorized third parties to misuse the the widget’s pre-fill feature. A signed URL helps limit access from unauthorized third parties by providing limited permissions and time to make a request. Passing theDocumentation Index
Fetch the complete documentation index at: https://dev.moonpay.com/llms.txt
Use this file to discover all available pages before exploring further.
signature parameter is mandatory if you’re using the walletAddress or walletAddresses parameter and it must be appended at the end of the URL. If your widget URL contains sensitive information, we strongly recommend using the signature parameter.
You can generate a signature of the URL server-side and append it to the end of the URL. If the signature is provided, we’ll check the validity of the query string to make sure it has not been altered. If the signature is invalid for any reason the MoonPay widget will fail to load.
How to sign URLs
Follow these steps for signing URLs:- Send your widget URL to your backend server.
- Generate the signature using the secret key found in your MoonPay dashboard.
- Use your own code to generate signatures and sign URLs
- Alternatively, use our Node SDK to generate signatures, sign URLs, and validate signatures.
- Return either the signature or entire signed URL.
- If using a SDK, return the signature and use
updateSignature. Do not encode the signature, as the SDK handles this. - If using a URL-based integration, return the entire signed URL. Ensure that the value of
signatureand other parameters are URL-encoded.
- If using a SDK, return the signature and use
- Show the widget using the SDK or URL.
Returning the signature vs entire signed URLIntegrations using an SDK: Return the signature by itself and use
updateSignatureIntegrations using URLs: Return the entire signed URLHow to generate signatures
- Create an HMAC (Hash-Based Message Authentication Code) using the SHA-256 hash function.
- Use your secret API key as the key and the original URL’s query string as the message.
- For URL-based integrations, make sure all query parameter values are URL-encoded before creating the signature.
All query parameter values (not the entire query string) need to be
URL-encoded before generating the signature in order for it to be valid.