Docs/Relay Token Requirements
Guides

Require and Spend Tokens for Matchmaking

Let players enter matchmaking with either 40 standard tokens or 40 gold tokens. At match start, spend standard tokens when they have enough; otherwise spend gold tokens. The queue requirement and match-start mutations both run on the Relay server.

Require Either Currency to Join the Queue

In Unity, open Tools → TurnKit → Configuration → Relay Configs, edit the target Relay, and add this queue requirement. Groups are OR branches, while conditions inside each group use the group combinator.

  • Group 1, combinator AND: STORE key token, operator GTE, value 40.
  • Group 2, combinator AND: STORE key gold_token, operator GTE, value 40.

Because the groups are OR branches, either balance is enough to pass the queue check.

Queue requirement with separate OR groups requiring 40 token or 40 gold_token
Two AND groups act as OR branches: 40 token or 40 gold_token qualifies the player.

Spend Currency When the Match Starts

Add two Player Store mutations in the same Relay configuration, each at phase ON_MATCH_START and target ACTING_PLAYER. The conditions choose one mutation, so only one balance is charged.

  1. Standard tokens: mutation ID token_on_start_reduction; key token; operation SUB; value 40; condition STORE token GTE 40.
  2. Gold tokens: mutation ID gold_token_reduction; key gold_token; operation SUB; value 40; combinator AND; conditions STORE token LT 40 and STORE gold_token GTE 40.
Relay mutation subtracting 40 standard tokens at match start when token balance is at least 40
Spend standard tokens when the balance is at least 40.
Relay mutation subtracting 40 gold tokens when normal token balance is under 40 and gold balance is at least 40
Otherwise spend gold tokens, when its balance is at least 40.

Save Relay changes and confirm your Player Store definitions include numeric token and gold_token keys. See TurnKit Relay and the Player Store reference for the related configuration concepts.

Require and Spend Tokens for Matchmaking | TurnKit Guide