Initiate Recharge Request
The recharge process involves communication between a child iframe (game page) and the parent page. This ensures a seamless and secure user experience for initiating and completing recharge transactions.
Step 1: Send Recharge Information
Overview:
• The game (child iframe) sends a recharge request to the UMIVERSE platform (parent page) using the postMessage API.
• This request contains critical information such as the order ID, recharge amount, merchant ID, timestamp, and a secure signature for verification.
Recharge Request Format
The following is the format of the recharge request sent from the child iframe to the parent page:
How to Send the Request:
Use the postMessage method in JavaScript to send the recharge information from the iframe to the parent page.
Signature Generation
The sign field is crucial for ensuring the integrity and authenticity of the request. The signature is generated as follows:
1. Algorithm:
• Concatenate the values of the parameters in the jsonData object (in the order they appear) into a single string.
• Append the current timestamp (ts) and the secret key (UMI-API-KEY) to the string.
• Use the MD5 hashing algorithm to generate the signature.
2. Code Implementation:
3. Example Usage:
Last updated