ConsumePeerCurrency
Consumes currency in a peer.
Service | Operation |
---|---|
virtualCurrency | CONSUME_PEER_VC |
Method Parameters
Parameter | Description |
---|---|
vcId | Type of currency (Ex. ticket, tokens) |
vcAmount | Currency amount to be consumed |
peer | Name of the peer |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var vcId = "tokens";
var vcAmount = 1;
var peerCode = "gameloot";
var virtualCurrencyProxy = bridge.getVirtualCurrencyServiceProxy();
var postResult = virtualCurrencyProxy.consumePeerCurrency(vcId, vcAmount, peerCode);
if (postResult.status == 200) {
// Success!
}
var vcId = "tokens";
var vcAmount = 1;
var peerCode = "gameloot";
var virtualCurrencyProxy = bridge.getVirtualCurrencyServiceProxy();
var postResult = virtualCurrencyProxy.consumePeerCurrency(vcId, vcAmount, peerCode);
if (postResult.status == 200) {
// Success!
}
JSON Response
{
"status" : 200,
"data" :
{
"currencyMap": {
"gems": {
"purchased": 0,
"balance": 0,
"consumed": 0,
"awarded": 0,
"revoked": 0
},
"gold": {
"purchased": 0,
"balance": 90,
"consumed": 10,
"awarded": 100,
"revoked": 0
}
}
}
}