Game ideas & features

Your next feature

Gift Codes

Let players enter and redeem gift codes.

Requires a player session
Unity
Your visible result

A test code is redeemed. Repeat redemption follows your rules.

Create a gift code0:36

Existing dashboard tutorial. It shows the previous design; the guide follows the current workflow.

Open video separately ↗

Build this feature

You can preview the guide. Running it requires an active project key. Prepare project

SDK installed, project configuration imported and player signed in.

C#
Assets/Scripts/GiftCodesDemo.cs
horizOn callSetup
1using UnityEngine;
2using PM.horizOn.Cloud.Core;
3using PM.horizOn.Cloud.Manager;
4​
5// Attach this script to a GameObject in your first scene.
6public class GiftCodesDemo : MonoBehaviour
7{
8 async void Start()
9 {
10 // Setup: initialize, connect and sign in a player.
11 HorizonApp.Initialize();
12 await new HorizonServer().Connect();
13 await UserManager.Instance.SignUpAnonymous("PlayerName");
14​
15 // horizOn: validate a gift code and redeem it.
16 // Validate first (optional)
17 bool? valid = await GiftCodeManager.Instance.Validate("PROMO2024");
18​
19 // Redeem
20 var result = await GiftCodeManager.Instance.Redeem("PROMO2024");
21 if (result?.Success == true)
22 {
23 // Parse result.GiftData for rewards
24 }
25 }
26}

Test your new feature.

A test code is redeemed. Repeat redemption follows your rules.

Choose the same project in the dashboard as in your game configuration.

Endpoints
  • POST/gift-codes/validate
  • POST/gift-codes/redeem
All endpoints in the API reference
Our suggestion for your next step

Give every round a high score.

Save the score after a round and show who's ahead. Keep using your connection and player session.