# Using OneTouch Originals in the SDK

{% hint style="success" %}
OneTouch Originals is available for the Operator Games API SDK starting from **SDK version v.1.1.2.**&#x20;

\
**The full CDN URL being** [**https://cdn.hub88.io/games-sdk/hub88-games-sdk-1.1.2.js**](https://cdn.hub88.io/games-sdk/hub88-games-sdk-1.1.2.js)
{% endhint %}

This guide walks you through the Operator Games API SDK integration with **OneTouch Originals offering**.&#x20;

For a high-level overview, check out [**the full guide on the SDK**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk). In the main guide you'll be able to learn about the [**full integration flow**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk/..#integration-flow), [**authorisation flow**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk/..#authorisation), [**error handling**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk/..#error-handling) and [**migration from iframe to the SDK**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk/..#migration-from-iframe-integration).&#x20;

To integrate the SDK only with **OneTouch Originals**, complete the following steps.

{% stepper %}
{% step %}

### Get your tokens by calling the Authorise API endpoint

Follow along [**the first step of the Operator Games API SDK integration guide**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk#step-1-authorise-game-session-backend-authorise-api) to ensure you have your `provider_token`, `provider_pid` and `launcher_base_url`.  \
This step is not needed if you have already authorised the SDK.
{% endstep %}

{% step %}

### Initialise the SDK with OneTouch Originals games

Initialise the SDK using your `provider_token`, `provider_pid` and `launch_base_url` you received from [**the Authorisation's response**](https://docs.hub88.io/developer-docs/operator-sdks/operator-games-api-sdk/..#step-1-authorise-game-session-backend-authorise-api). In this example, we also specify the `game_code` to be `'orgn_originalplinko'` . Using this, the OneTouch Originals game Plinko will be played.&#x20;

{% code title="Initialisation" lineNumbers="true" %}

```javascript
const hub88Instance = await Hub88Games.init({
  provider_token: 'your_token',
  provider_pid: 'your_pid',
  launcher_base_url: 'https://launcher.server1.ih.testenv.io',
  game_code: 'orgn_originalplinko'
})

```

{% endcode %}
{% endstep %}

{% step %}

### Initialise the SDK using advanced parameters

During initialisation, you can add custom values for optional parameters in order to change the game display ways. Just select the parameter which value you wish to override, and add to the `meta` object in the initialisation code snippet, and the SDK will override the values.[ **See the table for available parameters.**](#optional-parameters-for-meta-object)

{% code title="Initialisation using advanced parameters in meta object" lineNumbers="true" %}

```javascript
const hub88Instance = await Hub88Games.init({
  provider_token: 'your_token',
  provider_pid: 'your_pid',
  launcher_base_url: 'https://launcher.server1.ih.testenv.io',
  game_code: 'orgn_originalplinko',

  lang: 'en',           // Can be overridden by meta.lang
  meta: { // Highest priority
    theme: 'dark',      
    turboMode: true,
    mute: false, 
    depositUrl: 'https://example.com/deposit',
  }
})
```

{% endcode %}
{% endstep %}

{% step %}

### Add event listening for native window events

To further improve the experience, you can implement event listening for game round start and game round ending. This allows you to, for example, know when to display a custom win/lose animation.

**Events support**

```javascript
/**
 * Dispatched when a game play/round starts (e.g., bet is placed, balance is locked)
 */
export interface GamePlayStartedEvent extends Hub88GameEvent {
  name: 'game-play-started'
  kind: 'win' | 'loss' | 'bet' | 'unknown'
  balance: number
  currency?: string
}

/**
 * Dispatched when a game play/round ends (e.g., win/loss calculated, balance is unlocked)
 */
export interface GamePlayEndedEvent extends Hub88GameEvent {
  name: 'game-play-ended'
  kind: 'win' | 'loss' | 'bet' | 'unknown'
  balance: number
  currency?: string
  winAmount?: number
}
```

You can also **listen** **directly** to the **window** **custom** **event**:

```javascript
window.addEventListener('hub88-games-sdk', (e) => {
  const event = e.detail.event
  console.log('Hub88 Event:', event)
})
```

{% endstep %}
{% endstepper %}

***

### Optional parameters for `meta` object&#x20;

| Parameter name | Type    | Description                                                                                                                                                                                                    |            |
| -------------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| gameType       | string  | <ul><li>The identifier for the game to be loaded.</li><li><p>Possible values: </p><ul><li>"dice"</li><li>"plinko"</li><li>"roulette"</li><li>"blackjack"</li><li>"baccarat"</li><li>"hilo"</li></ul></li></ul> |            |
| sessionId      | string  | The unique session token for player authorization.                                                                                                                                                             |            |
| engineBaseUrl  | string  | The base URL of the game server (backend).                                                                                                                                                                     |            |
| lobbyUrl       | string  | The URL where the player will be redirected when exiting the game.                                                                                                                                             |            |
| depositUrl     | string  | The URL of the deposit page. A good practice would be to have the game display a button leading to this address if the player has insufficient funds.                                                          |            |
| subPartnerId   | string  | The sub-partner identifier for possible presets.                                                                                                                                                               |            |
| lang           | string  | The language code for game localisation (e.g., "en", "ja").                                                                                                                                                    |            |
| theme          | string  | <p>The visual theme for the game interface.<br>Possible values: <br>"light"                                                                                                                                    | "dark"</p> |
| fiatCurrency   | string  | The fiat currency code.                                                                                                                                                                                        |            |
| fiatRate       | string  | The currency rate for converting fiat currencies.                                                                                                                                                              |            |
| walletCurrency | string  | The wallet currency value.                                                                                                                                                                                     |            |
| skin           | string  | The skin (background) of the game displayed. Default value is `"bitcasino"`, `"yolo"` can be used for yolo.com.                                                                                                |            |
| mute           | boolean | Controls the game sound to be on or off.                                                                                                                                                                       |            |
