How Gita coins work
Gita coin (گیتا کوین) is the Baziness currency. Players earn it in your game, for example by winning matches, ranking in tournaments, opening gifts or buying packs. They spend it on real prizes in the reward shop. The balance lives on the platform, not in your database:
| Action | Who | How |
|---|---|---|
| Show the balance | your client | user/get-coin with the player's user token |
| Give coins | your server | client/add-coin with the client token |
| Spend coins | the player | inside the reward shop page; your game does nothing |
Warning
Never treat a locally stored number as the balance, and never let the client add coins.
Showing the balance
Refresh the balance:
- right after the client gets its token
- when a Baziness page closes, because the player may have spent coins in the reward shop
- when the game comes back to the foreground
- after your server gave coins
While the balance is unknown, or the call failed, show … or hide it. Never show 0: the player would think their coins are gone.
Giving coins safely
Every payout needs a unique transactionId built from what the payout is, for example match:17 or reward_claim:42 (the formula). Then:
- a retry, a double tap or a repeated request can never pay twice: the platform refuses the repeat with
400 - treat that
400as "already paid" and finish your own bookkeeping - record every payout in your own ledger too (who, how much, why), for support and reports
Players who haven't signed in
A guest still has an anonymous Baziness user, so coins can be given to them. Many games still draw a line at signed in:
| Kind of payout | Player not signed in | Why |
|---|---|---|
| Claims: a reward the player taps to collect (a win, a tournament prize, a gift) | refuse with a "sign in first" error; the client opens the sign-in page and retries after a successful sign-in | coins spent on real prizes should belong to a real account |
| Payouts that must not fail: a paid purchase that includes Gita coins | keep the coins in a local holding balance on your server | a paid order must never fail |
| When the player signs in | move the whole holding balance to Baziness with one add-coin (its own transactionId), then set the local balance to zero |
the coins move exactly once |
When Baziness is off, keep Gita coin rewards in that local balance as well, so your economy stays testable without credentials.
Showing the currency honestly
- Call it «گیتا کوین» everywhere, with its own icon.
- A build that ships without Baziness must not advertise Gita coin rewards.
Ready-made code: giving coins, showing the balance.