This section is for developers who want to use their own in-game currency instead of Galaxy Coins. Galaxy Coin prizes are fulfilled automatically and don't require any setup.

How prizes work

You can set up prizes on your dashboard for different things - getting a top score, earning an achievement, inviting friends, etc. Prizes can be added to other features like Leaderboards, Achievements, and Matches. You can do this in your dashboard in the relevant feature section.

If you choose to reward your users with your own currency, use these functions to keep track of balance updates you need to make.

⬇️ Get pending prizes

This will return the un awarded prizes for the current player.

 GalaxyClientAPI.GetPrizes(new GalaxySDK.ClientModels.GetPrizesRequest { }, 
 result => { 
     //Add prize to user's balance from result.Prizes (list)
     //E.g. userCoins += result.Prizes[0].Amount
 }, error => { });
Prize Response Object


/// User records for the requested user.
public List<Prize> Prizes;

Prize reference

Currency reference

⬆️ Award a prize

Once you award the in-game currency to your player, make sure you set the prize as awarded in Galaxy so it's not returned in the GetPrizes function in the future.

GalaxyClientAPI.AwardPrize(new GalaxySDK.ClientModels.AwardPrizeRequest { 
    Id = PrizeIdToAward
}, result => { }, error => { });

🔀 Example flow

This is an example implementation of how to use both functions to get pending prizes and clear them. This assumes that you only have one coins currency added. If you award prizes with multiple currencies, you can check prize.Currency (Currency reference)

GalaxyClientAPI.GetPrizes(new GalaxySDK.ClientModels.GetPrizesRequest { },
result =>
     var coinsToAdd = 0;
     //Iterate through each pending prize
     foreach (Prize prize in result.Prizes)
         coinsToAdd += prize.Amount; //Increment currency by Amount
         //Clear prize from pending prize list by ID
         GalaxyClientAPI.AwardPrize(new GalaxySDK.ClientModels.AwardPrizeRequest
             Id = prize.Id
         }, result => { }, error => { Debug.LogError(error); });
}, error => { Debug.LogError(error); });

Last updated