> For the complete documentation index, see [llms.txt](https://docs.hub88.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.hub88.io/developer-docs/operator-api-reference/operator-api-overview/demo-and-real-gameplay.md).

# Demo and Real Gameplay

## Gameplay overview

When building an integration with Hub88 you can start with setting up DEMO mode to ensure that all data communication flows correctly.&#x20;

To start setting up the full gameplay, either in **DEMO** mode or **Real** mode, you'll need to meet the prerequisites outlined in [Getting Started](/developer-docs/operator-api-reference/getting-started.md) and get acquainted with the API in [Operator API Overview](/developer-docs/operator-api-reference/operator-api-overview.md).&#x20;

The gameplay logic will process is as follows with API call modifications needed for [DEMO mode](#demo-gameplay).

{% hint style="info" %}
Note that the process is different for **DEMO** and **REAL** gameplay modes.&#x20;

**In** **DEMO** mode, user can open the game, check the rules/graphics, and play with fun mode money.
{% endhint %}

{% stepper %}
{% step %}
Obtain a game URL from Hub88 by calling [`POST /operator/generic/v2/game/url`](/developer-docs/operator-api-reference/games-api.md#get-a-game-url) .
{% endstep %}

{% step %}
**Direct** the customer to the **URL** **provided** by **Hub88**.
{% endstep %}

{% step %}
Respond to in-game events sent by Hub88 and update the customer's balance (**SEAMLESS WALLET ONLY**)
{% endstep %}
{% endstepper %}

{% hint style="success" %}
**The high level gameplay corresponds to** [**the core communications flow between Supplier and Operator APIs.**](/developer-docs/hub88-apis/core-api-flow.md)
{% endhint %}

## Demo gameplay

{% hint style="info" %}
Note that the process is different for **DEMO** and **REAL** gameplay modes.&#x20;

**In** **DEMO** mode, user can open the game, check the rules/graphics, and play with demo mode money.
{% endhint %}

{% stepper %}
{% step %}
**Operator** makes a **Game API** call to [`POST /operator/generic/v2/game/url`](/developer-docs/operator-api-reference/games-api.md#get-a-game-url) to obtain game launch URL.&#x20;

For **DEMO** mode, Operator has to pass `"currency":"XXX"`. \
Parameters `token`, `user` can be **omitted**.
{% endstep %}

{% step %}
When the game URL is returned, the **Operator** uses it to direct the player to the game (for example, launch it in iframe or redirect the player to the URL).
{% endstep %}

{% step %}
In **DEMO** mode, no calls to Operator's API are made because providers handle the balance themselves.\
If player liked the game and wants to switch to **REAL** mode, **Operator** should proceed with the next steps.
{% endstep %}
{% endstepper %}

## Real gameplay

{% stepper %}
{% step %}
The Operator generates and stores a unique game session token.
{% endstep %}

{% step %}
The Operator makes a Game API call [`POST /operator/generic/v2/game/url`](/developer-docs/operator-api-reference/games-api.md#get-a-game-url) and passes the generated token along with the other request parameters.

{% hint style="info" %}
**NB!**: In case of **SEAMLESS WALLET** integration, Operator needs to be ready to respond to balance API calls even before getting the game URL back.
{% endhint %}
{% endstep %}

{% step %}
When the game URL is returned, the Operator uses it to direct the player to the game (for example, launch it in iframe or redirect the player to the URL).
{% endstep %}

{% step %}
{% hint style="info" %}
Following steps are for **SEAMLESS WALLET integration only**. \
\
In case of **Transfer Wallet** integration, all game actions and balance updates will be handled on Hub88 side.
{% endhint %}
{% endstep %}

{% step %}
When the game URL is loaded in the browser, Hub88 server makes a Wallet API call [`/user/balance`](/developer-docs/operator-api-reference/wallet-api.md#post-user-balance) to the Operator's server.
{% endstep %}

{% step %}
The Operator verifies the token against the stored token and returns the user's balance. The user can then place a bet.
{% endstep %}

{% step %}
When the user attempts to place a bet, a Wallet API call [`/transaction/bet`](/developer-docs/operator-api-reference/wallet-api.md#post-transaction-bet) is triggered on the Operator's server.
{% endstep %}

{% step %}
The Operator verifies the token, ensures that the user has enough money for this bet, decreases the user's balance by the bet amount, and returns the updated user's balance.
{% endstep %}

{% step %}
If the user wins, the Wallet API triggers a call [`/transaction/win`](/developer-docs/operator-api-reference/wallet-api.md#post-transaction-win) on the Operator's server.
{% endstep %}

{% step %}
The Operator verifies the token, increases the user's balance by the win amount, and returns the updated user's balance.
{% endstep %}

{% step %}
Behaviour in case of user's loss depends on game provider's internal logic. Possible options:

* Nothing is sent
* Sent win with amount 0
  {% endstep %}
  {% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.hub88.io/developer-docs/operator-api-reference/operator-api-overview/demo-and-real-gameplay.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
