Validate Gift Code
horizon_validate_gift_codeCheck if a gift code can be redeemed by a player before claiming it, without consuming it. Confirms typed codes early and returns valid=false for expired, revoked, or limited codes.
Instructions
Checks whether a gift code can be redeemed by this player right now, without using it up. Use when: before horizon_redeem_gift_code, for example to confirm a code the player typed and show an error early. Not for: claiming the reward (use horizon_redeem_gift_code; validating alone grants nothing). Requires: a userId from horizon_signup_* or horizon_signin_*; no session token. Side effects: None (read only); no redemption is used. Returns: {valid}. valid false means the code does not exist, has expired, was revoked or reached its limit for this player or in total; tell the player the code does not work. Errors: Needs HORIZON_API_KEY. Every failure returns an error result (isError) with the HTTP status and body: a 401 that horizon_test_connection also returns means HORIZON_API_KEY is wrong, 429 means the account's per-minute rate limit was reached (wait a minute, then retry).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| code | Yes | Gift code as the player typed it (max 50 characters) | |
| userId | Yes | Player user ID (UUID) from horizon_signup_* or horizon_signin_* |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| valid | No |