>

JavaScript API - showBuyConfirmation

Opens confirmation for buy coins

Parameters

NameRequiredTypeDescription
actionYStringaction type
amountYIntegeramount of operation
priceYIntegerprice of operation
projectIdYIntegerID of project
remoteIpNStringRemote ip of client
serverNStringName of server
characterNameNStringCharacter of query
param1NStringCustom param 1
param2NStringCustom param 2
param3NStringCustom param 3

Example of use

<script type="text/javascript">
    window.addEventListener('message', function(data){
                let response = data.data;
                if (response.name === 'showBuyConfirmationResult'){
                    console.log(response.result);
                }
            })
</script>

<input onclick="GSAPI.UI.showBuyConfirmation(
'buy',             //action 
1,                 //amount
2,                 //price
123123,            //projectId
'127.0.0.1',       //remoteIp
'server-name',     //server
'character-name',  //characterName
'123',             //param1
'222',             //param2
'444'              //param3
);" type="button" value="Show Buy Confirmation">

Example of responses

Successful response

{
    "success": true,
    "code": 0,
    "description": "OK",
    "transactionId": "3020944",
    "price": "2",
    "balance": 716,
    "param1": "123",
    "param2": "222",
    "param3": "444",
    "sign": "ecc1f569460ae5ee609c8cb49ce5878f"
}

Failed response with incorrect project

Response will be without sign because we don't have key to sign in this case

{
    "success": false,
    "code": 8,
    "description": "Wrong project Id",
    "param1": "123",
    "param2": "222",
    "param3": "444"
}

Failed response with different reason

{
    "success": false,
    "code": 1,
    "description": "Not enough money for purchase",
    "transactionId": "3020945",
    "price": "2",
    "balance": 718,
    "param1": "123",
    "param2": "222",
    "param3": "444",
    "sign": "ecc1f569460ae5ee609c8cb49ce5878f"
}
Помощь