Skip to main content
Version: 5.7.0

AwardCurrency

Award user the passed-in amount of currency. Returns an object representing the new currency values.

note

Awarding 0 or negative currency will return an error. Use ConsumeCurrency to remove currency values.

caution

For security reasons calling this API from the client is not recommended, and is rejected at the server by default. To over-ride, enable the 'Allow Currency Calls from Client' compatibility setting in the Design Portal.

ServiceOperation
virtualCurrencyAWARD_VC

Method Parameters

ParameterDescription
vcIdThe currency type to award.
vcAmountThe amount of currency to award.

Usage

http://localhost:3000
string vcId = "coins";
int vcAmount = 1;
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.VirtualCurrencyService.AwardCurrency(vcId, vcAmount, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"currencyMap": {
"gems": {
"purchased": 0,
"balance": 0,
"consumed": 0,
"awarded": 0,
"revoked": 0
},
"gold": {
"purchased": 0,
"balance": 123,
"consumed": 0,
"awarded": 123,
"revoked": 0
}
}
}
}