Virtual Currency
The VirtualCurrency Service manages virtual currency balances for app users.
This service replaces the currency functions of the deprecated Product Service. The currency APIs of the two services are largely the same, with the following two changes:
- For security purposes, only the get methods are callable from the client -- use Cloud Code for the rest
- We have cleaned up the responses a bit, removing unnecessary fields like
createdAt
,updatedAt
andprofileId
API Summary
User Currency
- GetCurrency - get current currency balances
- AwardCurrency - call when currency is awarded
- ConsumeCurrency - call when currency is consumed
- ResetCurrency - resets the users currency balances to zero
- RevokeCurrency - Revoke the specified amount of currency from the user. User's balance can go negative
- SysGetCurrencyTypes - retrieves the virtual currency types defined for the current app
Note that there are Parent and Peer versions of these APIs available as well.
📄️ AwardCurrency
Award user the passed-in amount of currency. Returns an object representing the new currency values.
📄️ AwardParentCurrency
Award parent user the passed-in amount of currency. Returns an object representing the new currency values.
📄️ AwardPeerCurrency
Used to award Peer currency.
📄️ ConsumeCurrency
Consume the passed-in amount of currency from the player.
📄️ ConsumeParentCurrency
Consumes currency in a parent app.
📄️ ConsumePeerCurrency
Consumes currency in a peer.
📄️ GetCurrency
Gets the player's currency for the given currency type or all currency types if null passed in.
📄️ GetParentCurrency
Gets the parent player's currency for the given currency type or all currency types if null passed in.
📄️ GetPeerCurrency
Gets the peer currency for the given currency type or all currency types if null passed in.
📄️ ResetCurrency
Resets the player's currency back to zero.
📄️ ResetParentCurrency
Resets the player's parent currency back to zero.
📄️ ResetPeerCurrency
Resets the peer user's currency back to zero.
📄️ RevokeCurrency
Revoke the specified amount of currency from the user. User's balance can go negative.
📄️ RevokeParentCurrency
Revoke the specified amount of currency from the parent user. Parent user's balance can go negative
📄️ RevokePeerCurrency
Revoke the specified amount of currency from the peer user. Peer user's balance can go negative.
📄️ SysGetCurrencyTypes
Retrieves the virtual currency types defined for the current app.
📄️ SysGetParentCurrencyTypes
Retrieves the virtual currency types inherited from the parent app(s).
📄️ SysGetPeerCurrencyTypes
Retrieves the virtual currency types inherited from the configured peer apps.