GetCurrency
Gets the player's currency for the given currency type or all currency types if null passed in.
Service | Operation |
---|---|
product | GET_PLAYER_VC |
Method Parameters
Parameter | Description |
---|---|
currencyType | The currency type to retrieve or null if all currency types are being requested. |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
string currencyType = "coins";
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.ProductService.GetCurrency(currencyType, successCallback, failureCallback);
const char *currencyType = "coins";
_bc->getProductService()->getCurrency(currencyType, this);
NSString *currencyType = @"coins";
BCCompletionBlock successBlock; // define callback
BCErrorCompletionBlock failureBlock; // define callback
[[_bc productService] getCurrency:currencyType
completionBlock:successBlock
errorCompletionBlock:failureBlock
cbObject:nil];
String currencyType = "coins";
this; // implements IServerCallback
_bc.getProductService().getCurrency(currencyType, this);
public void serverCallback(ServiceName serviceName, ServiceOperation serviceOperation, JSONObject jsonData)
{
System.out.print(String.format("Success | %s", jsonData.toString()));
}
public void serverError(ServiceName serviceName, ServiceOperation serviceOperation, int statusCode, int reasonCode, String jsonError)
{
System.out.print(String.format("Failed | %d %d %s", statusCode, reasonCode, jsonError.toString()));
}
var currencyType = "coins";
_bc.product.getCurrency(currencyType, result =>
{
var status = result.status;
console.log(status + " : " + JSON.stringify(result, null, 2));
});
// N/A
var currencyType = "coins";
var productProxy = bridge.getProductServiceProxy();
var postResult = productProxy.getCurrency(currencyType);
if (postResult.status == 200) {
// Success!
}
{
"service": "product",
"operation": "GET_PLAYER_VC",
"data": {
"vc_id": "coins"
}
}
JSON Response
{
"status": 200,
"data": {
"updatedAt": 1479752110785,
"currencyMap": {
"gems": {
"purchased": 0,
"balance": 12212,
"consumed": 133,
"awarded": 12345
}
},
"parentCurrency": {
"Master": {
"credits": {
"purchased": 0,
"balance": 12212,
"consumed": 133,
"awarded": 12345
}
}
},
"peerCurrency": {
"gameLootPeer": {
"tickets": {
"purchased": 0,
"balance": 12212,
"consumed": 133,
"awarded": 12345
}
}
},
"playerId": "362ce861-b749-4ce4-a57a-175232e21b5d",
"createdAt": 1459439058040
}
}