When a player needs to buy a certain item in game, the client will call the javascript function in the game page. The game page (usually a iframe) which contains the game client will post a message to its parent.Post message from client#
Parameters in {opt}#
| PARAMETER | TYPE | REQUIRED | DESCRIPTION |
|---|
| serverId | number | true | Game Server ID |
| cpOrderId | string | true | Order ID from the content provider |
| productId | string | true | Prodcut ID in game |
| productName | string | false | Prodcut name in game |
| productDesc | string | false | Prodcut description in game |
| productNumber | number | false | Product number, default is 1 |
| productPrice | number | true | Product price |
| extParams | string | true | Any extra parameters in string |
Parent event#
When the event is received by the parent of the iframe, it can be parsed according to the parameters passed, either popping up a payment window or redirect to the payment page.There is an example in 2cy.games: Modified at 2023-04-25 05:43:20