
灵活的奖励内容
奖励数据为自由格式的 JSON,你可以发放游戏能识别的任意货币、道具或标记组合。
精细化限制
为每个礼品码独立设置全局兑换上限、单用户兑换上限和过期时间。
即时撤销
如果礼品码泄露或被滥用,可在 Dashboard 中即刻撤销,无需推送 App 更新。
快速集成
兑换礼品码
输入礼品码
在下方输入你的促销码
WINTER2024
// Unity C#: Gift Codes (needs a signed in player)
using PM.horizOn.Cloud.Manager;
using UnityEngine;
// Validate without redeeming (true, false, or null when the request failed)
bool? valid = await GiftCodeManager.Instance.Validate("SUMMER2025");
// Redeem: giftData is the JSON payload you set in the dashboard
var result = await GiftCodeManager.Instance.Redeem("SUMMER2025");
if (result != null && result.success)
{
Debug.Log($"Rewards: {result.giftData}");
}# REST API: Gift Codes
# Validate a gift code (does not redeem)
curl -X POST https://horizon.pm/api/v1/app/gift-codes/validate \
-H "X-API-Key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"userId":"USER_ID","code":"SUMMER2025"}'
# Redeem a gift code (needs the player's session token)
curl -X POST https://horizon.pm/api/v1/app/gift-codes/redeem \
-H "X-API-Key: YOUR_API_KEY" \
-H "Authorization: Bearer SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{"userId":"USER_ID","code":"SUMMER2025"}'这些示例使用 Unity SDK(C#)和 REST API。Godot 和 Unreal 在各自的 SDK 中有相同的调用: 参见快速入门
