Last Updated: 2/15/2022, 3:26:51 AM

# Rewards

# Overview

Rewards are an effective way to increase player retention and brand loyalty by granting players special items or other entitlements in recognition of their achievements. Players who are rewarded for their progress will engage with your game even more, to make sure they get the most rewards possible. Rewards come in several different types, including items, new maps, badges, and more.

The Rewards service works by integrating with our Statistics and Achievements services to define the benchmarks players must clear to earn rewards, and with our Entitlements and Fulfillment services to grant players the rewards they’ve earned.

# Prerequisites

# Permissions

Permissions are used to grant access to specific resources within our services. Make sure your account has the following permissions before you attempt to manage rewards in the Admin Portal. For a full list of permissions that impact achievements management, see the Social tab of the permissions reference.

Usage Permission Tag Action
Create a Reward ADMIN:NAMESPACE:{namespace}:REWARD Create
Get a Reward ADMIN:NAMESPACE:{namespace}:REWARD Read
Import Reward Configurations ADMIN:NAMESPACE:{namespace}:REWARD Create
Export Reward Configurations ADMIN:NAMESPACE:{namespace}:REWARD Read

Permissions work slightly differently depending on whether they are assigned to IAM Clients or Roles assigned to users. For more information, read the Authentication and Authorization documentation.

# Managing Rewards in the Admin Portal

# Create a New Reward Configuration

  1. In the publisher namespace of the Admin Portal, go to the E-Commerce section and open the Rewards menu.

    rewards

  2. In the Rewards page, click the Add Configuration button.

    rewards

  3. TheAdd Rewards form appears, as shown below. Fill in the following fields with the required information:

    rewards

    • Enter a unique identifier for your reward in the Reward Code field. The reward code must follow the formatting rules provided.

    • Enter a description of the reward in the Description field.

    • Select the trigger for the reward from the Event Topic dropdown menu. You can choose either Statistic, Achievement, or User Account.

      NOTE

      Choose Statistic if you want the reward to be granted to players that achieve a certain statistic. For example, you could create a statistic to measure consecutive days logged in and use it to reward players for logging into your game 7 days in a row.

      Choose Achievement if you want the reward to be granted to a player when they earn a particular achievement.

      Choose User Account if you want the reward to be granted to players after they make an account in your platform, using either their email address or an account from a 3rd party platform, such as Steam.

    • Advanced Settings

      • Enter the specific condition that indicates the target User ID in the event payload in the UserID Expression field, using the JSON path format. This field is optional. If left blank, the default value is $.[0].userId. Format:

        $.eventPayloadObject.userId
        
      • Enter the specific condition that indicates the target User ID in the event payload in the Namespace Expression field, using the JSON path format. This field is optional. If left blank, the default value is $.[0].namespace. Format:

        $.eventPayloadObject.namespace
        
    • Input the maximum number of times the reward can be awarded in the Max Awarded field.

    • Input the maximum number of times the reward can be awarded to a single player in the Max Awarded Per User field.

    When you’re done, click Add. The new reward will be added to the list.

# Add a Reward Condition

  1. On the Rewards page of the Admin Portal, open the desired reward by clicking View in the reward’s Action column.

    rewards

  2. Then, click the Add Reward Condition button.

    rewards

  3. The Add Reward Condition form appears. Fill in the fields with the required information:

    rewards

    • Enter the name of the event that you want to trigger the reward in the Event Name field. Here’s the list of possible event names:

      Event Name Usage
      statItemUpdated Use this event name if you want players to receive the reward upon reaching a particular statistical value.
      achievementUnlocked Use this event name if you want players to receive the reward upon earning a particular achievement.
      userAccountCreated Use this event name if you want players to receive the reward upon creating an account in your game or platform.
      thirdPartyAccountCreated Use this event name if you want players to receive the reward upon creating an account on your platform from a third party platform. Both userAccountCreated and thirdPartyAccountCreated are contained within the User Account event topic.
      • Enter a name for the specific event condition that triggers the reward in the Condition Name field.

      • Enter the specific condition that triggers the reward in JSON path format in the Condition field. The format for each event topic is given below.

        • Event Topic: Statistics To grant players the reward for reaching a certain statistic, use this JSON path format.

          $.[?(@.statCode == "input-your-stat-code" && @.latestValue == x)]
          
          • Input the statCode for the statistic you’re using. This code can be found by looking up the desired statistic in the Admin Portal.
          • Input the statistical value at which the reward will be granted as the latestValue.

          Here’s an example where a player is rewarded for reaching 30 points for the serverstat3 statistic.

          $.[?(@.statCode == "serverstat3" && @.latestValue == 30)]
          
        • Event Topic: Achievements To grant players the reward for earning a certain achievement, use this JSON path format.

          $.[?(@.userAchievement != null && @.userAchievement.status == 2 && @.userAchievement.achievementCode == "input-your-achievement code")]
          
          • Input !=null in the userAchievement field. This confirms that the achievement exists and is not zero.
          • Define the userAchievement.status. This determines when the player will receive the reward. Input 1 if the player will receive the reward when the achievement is in progress, or input 2 if the reward will be granted when the player receives the achievement.
          • In the userAchievement.achievementCode field, input the code for the achievement the reward is related to. This code can be found by looking up the desired achievement in the Admin Portal.

          In this example, the player will receive a reward when they receive the achievement for killing 10 enemies.

          $.[?(@.userAchievement != null && @.userAchievement.status == 2 && @.userAchievement.achievementCode == "kill-enemies-achievement")]
          
        • Event Topic: User Account To grant players the reward for creating an account in your platform, use this JSON path format.

          $.[?(@.userId != null && @.emailAddress != null)]
          
          • Input !=null in the userId field. This confirms that the user ID is not null.
          • Input !=null in the emailAddress field. This confirms that the email address is not null.
        • Event Topic: User Account, Third Party Login To grant players the reward upon creating an account on your platform from a 3rd party platform such as Steam or Xbox, use this JSON path format.

          $.[?(@.userId != null)]
          
          • Input !=null in the userId field. This confirms that the user ID is not null.
      • Fill in the Reward Item fields with the required information:

        • Select the Item you want to grant as a reward. Any item published in your store can be granted as a reward.
        • Input the quantity of the item you want to include in the reward in the Qty field.
        • If the reward item is a subscription, input how many days the subscription should last in the Duration field. If the item you selected is any other type, you can leave this field blank.
        • To add more items to the reward, click Add More Items. You can select an additional item to add to the reward and set its quantity and duration.
  4. When you’re done adding items, click Save. The new reward condition will be added to the list.

    rewards

# Export Reward Configurations

You can export a reward configuration in JSON format by following the steps below.

  1. In the Rewards menu of the Admin Portal, open the dropdown menu next to the Add Configuration button. Then, click Export Configuration.

    rewards

  2. The download will be started. Once it’s finished, you can open the JSON file and see a list of your reward configs.

# Import Reward Configurations

  1. In the Rewards menu of the Admin Portal, open the dropdown menu next to the Add Configuration button. Then, click Import Configuration.

    rewards

  2. Fill in the Import Configuration form that appears.

    rewards

    • Choose the File to Import. The file should be in JSON format.
    • Select the Import Method.
      • Choose Replace if you want to replace an old config with a new one. The new config must have the same reward code as the config you want to replace. If you have multiple configs in your file, any configs with unique reward codes will also be imported.
      • Choose Leave Out if you want to add a new config without replacing any old configs. Using this method, any configs in your JSON file whose reward codes match existing configs will not be imported. Only configs with unique reward codes will be imported. Click Import when you’re done.
  3. Confirm the import configuration by typing IMPORT in the pop-up form below.

    rewards

# Implementing Rewards using the SDK

# Rewards Notification

When the Rewards service successfully fulfills an item to a player, the game client will receive a notification through the Lobby service. The topic of the message sent to the game client is e-commerce/reward. You can retrieve the notifications from the game by setting the delegate SetMessageNotifDelegate. You can also pull the notifications by using GetAllAsyncNotification for Unreal and PullAsyncNotifications for Unity. This allows the player to see any missed notifications. The payload of the function below will be in JSON format.

# Retrieve Reward Information by the Reward Code

You can retrieve information about a reward granted to a player by using the following function. This function uses the reward code to find the reward information.

# Retrieve Reward Information by Reward ID

You can retrieve information about a reward granted to a player by using the following function. This function uses the reward ID to find the reward information.

# Retrieve All Rewards

You can retrieve all rewards with a particular event topic, either Achievement, Statistic, or User Account. You can also sort the displayed data. For Unity define your sorting method in the RewardSortBy field, and for UE4, define the sorting method in the EAccelByteRewardListSortBy field. Here are the possible sorting methods.

Sort Usage
NONE This option uses the default sorting, which is to sort by namespace and then reward code in ascending order.
NAMESPACE_ASC Sort by namespace in ascending order.
NAMESPACE_DESC Sort by namespace in descending order.
REWARDCODE_ASC Sort by reward code in ascending order.
REWARDCODE_DESC Sort by reward code in descending order.
  • Learn more about how our Statistics service works.
  • Take a look at our Achievements guide.
  • Rewards are taken from items in your store, so make sure to learn about our Catalog service.