1. Ask for your credentials
The Baziness platform team gives you these values, one set per environment (development and production):
| Value | Example | Used by | Secret? |
|---|---|---|---|
| Client id | 12 |
your server, to get a client token | no, but keep it private |
| Client secret | •••••••• |
your server, to get a client token | yes — server only |
| Platform package name | com.karizmastudio.example |
every Baziness page link (packageName) |
no |
| Game name | example |
the reward page and the game offer page (game_name) |
no |
| Pay package name | com.karizmastudio.example |
every Baziness Pay call (pname); may differ from the platform package |
no |
| SKUs | example_pack |
the products you sell with Baziness Pay | no |
Warning
The client secret must never reach a browser or an app build: not in client code, not in a
VITE_*orNEXT_PUBLIC_*variable, not in git. Anyone holding it can create players and give Gita coins as your game.
2. Understand the two tokens
Everything on the platform uses one of two tokens. Keeping them apart is the key to the whole integration:
| Token | Who has it | How it is obtained | What it is for |
|---|---|---|---|
| Client token | your server only | client id + client secret → client/auth |
every server-to-server call: creating players, checking tokens, giving coins |
| User token | the player's client (from your server) | client/create-user or client/get-user-token |
opening Baziness pages as this player (linkedToken), reading their coin balance |
3. Follow the steps
| # | Step | Where | Details |
|---|---|---|---|
| 1 | Your server gets a client token with the client id and secret | server | Platform API → step 1 |
| 2 | On a player's first visit, your server creates their Baziness user and saves its id. On later visits it gets a fresh user token | server | steps 2–3 |
| 3 | Your client shows Baziness pages (sign-in, profile, rewards) with the user token, and listens to their messages | client | Baziness pages |
| 4 | When the player signs in on a page, your server checks the token and links the account (or switches to the player's other account) | server | Login, step 4 |
| 5 | Your client shows the Gita coin balance, and your server gives Gita coins for wins and rewards | both | Gita coins, steps 5–6 |
| 6 | The «انتخاب جایزه» button opens the reward page; the tutorial can open your game offer page | client | Reward page, Tutorial offer page |
| 7 | Sell items with Baziness Pay | both | Baziness Pay |
| 8 | Tag the links that bring players in with UTM parameters | both | Links & UTM |
Ready-made code for every step is in Server code and Client code. The example game puts it all together.
4. Configure your server
The example game and the code samples read these settings. Use the same names, so samples can be copied unchanged:
| Setting | Example | Meaning |
|---|---|---|
BAZINESS_PLATFORM_ENABLED |
true |
master switch. While false, the game shows no Baziness UI at all |
BAZINESS_PLATFORM_USE_PRODUCTION |
false |
false = development URLs, true = production URLs |
BAZINESS_CLIENT_ID |
12 |
client id |
BAZINESS_CLIENT_SECRET |
•••• |
client secret (secret) |
BAZINESS_PLATFORM_PACKAGE_NAME |
com.karizmastudio.example |
packageName on page links |
BAZINESS_GAME_NAME |
example |
game_name on the reward and offer pages |
BAZINESS_PAY_ENABLED |
true |
turns the buy buttons on |
BAZINESS_PAY_BASE_URL |
https://pay-dev.karizmastudios.org |
the Pay server for this environment |
BAZINESS_PAY_PACKAGE_NAME |
com.karizmastudio.example |
pname on every Pay call |
BAZINESS_SKU_PREFIX |
(empty) | optional: SKU = prefix + product id |
The platform counts as on only when BAZINESS_PLATFORM_ENABLED=true and both the client id and the secret are set. A half-configured server then behaves as if Baziness didn't exist.