Incentives #

The Incentives system encourages social interactions and engagement through rewards for senders and recipients. Learn more in the Incentives concept guide.

Overview #

Incentives enable your game to:

  • Create and manage sender incentives.
  • Allow recipients to claim incentives.
  • Track incentive statuses and claims.

Before You Start #

Ensure that you have:

  • Unity project configured with Hiro SDK.
  • Nakama system integrated (guide).

Managing Sender Incentives #

Listing Sender Incentives #

Retrieve all sender incentives for a player:

1
2
3
4
5
6
7
incentives_list = await hiro_client.incentives_sender_list()
for incentive in incentives_list:
    for key, value in incentive.claims.items():
        print(f"{key} claimed at {value.claim_time_sec}.")

    for user_id in incentive.unclaimed_recipients:
        print(f"{user_id} has not yet claimed.")

Creating Sender Incentives #

Create a new sender incentive:

1
2
3
4
5
request = IncentiveSenderCreateRequest()
request.id = "coin-invite"

result = await hiro_client.incentives_sender_create(request)
print(result.incentives[0].code)  # Code to share with another player

Claiming Sender Incentives #

Claim a sender incentive:

1
2
3
4
request = IncentiveSenderClaimRequest()
request.code = code

result = await hiro_client.incentives_sender_claim(request)

Deleting Sender Incentives #

Delete an existing sender incentive:

1
2
3
4
request = IncentiveSenderDeleteRequest()
request.code = code

result = await hiro_client.incentives_sender_delete(request)

Managing Recipient Incentives #

Retrieving Recipient Incentives #

Get information about a recipient incentive:

1
2
3
4
request = IncentivesRecipientGetRequest()
request.code = code

result = await hiro_client.incentives_recipient_get(request)

Claiming Recipient Incentives #

Claim a recipient incentive reward:

1
2
3
4
5
request = IncentiveRecipientClaimRequest()
request.code = code

result = await hiro_client.incentives_recipient_claim(request)
print(result.reward)