Manage User Balance Through API
Do I need this?
If you want to manage your users' balance in your system, you can use this API.
This API can:
Prerequisites
- Active account in the Scrimmage Rewards Program
- User's auth token. Check the Get started section for more details.
Get player balance
Check Get game information for user endpoint.
Response example:
{
"tokens": 0,
"levelConfig": {
...
},
"nextLevelConfig": {
...
},
"properties": {
...
}
}
Use tokens field to get player's balance in tokens.
Deduct player's tokens
Check Charge user endpoint.
Body example:
{
"amount": 100,
"transactionId": "unique_transaction_id",
"reason": "T-shirt purchase"
}
It means you want to charge players 100 tokens for the T-shirt purchase. The reason will be shown in the player's transaction history.
Add tokens to player's balance
We recommend creating a special data type for adding tokens to player's balance and game rule for it.
Updated 5 months ago