# API Endpoints

## Games API

## Request game landing URL

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>/game/url`

The game operator will open a new window with the provided game url to allow the user to access the game.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |

#### Request Body

| Name                                        | Type   | Description                                                                                             |
| ------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------- |
| username<mark style="color:red;">\*</mark>  | String | The username of the user in the operator's system.                                                      |
| traceId<mark style="color:red;">\*</mark>   | String | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request.         |
| gameCode<mark style="color:red;">\*</mark>  | String | Game code of the selected game in Game Aggregator's system.                                             |
| language<mark style="color:red;">\*</mark>  | String | <p>The selected language which the game should be opened.<br><br>Default: 'en'</p>                      |
| platform<mark style="color:red;">\*</mark>  | String | <p>The platform that the game will open on.<br><br>Possible values:<br>1. web (default)</p><p>2. H5</p> |
| currency<mark style="color:red;">\*</mark>  | String | ISO-4217 currency code (eg. USD)                                                                        |
| lobbyUrl<mark style="color:red;">\*</mark>  | String | Operator site Url to navigate the user back to the game lobby.                                          |
| ipAddress<mark style="color:red;">\*</mark> | String | User's location IP Address in either IPv4 or IPv6 format.                                               |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "status": "SC_OK",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "data": {
        "gameUrl": "https://zf006.prerelease-env.biz/gs2c/playGame.do?key=token%3Df8c3de3d-1fea-4d7c-a8b0-29f63c4ab146%26symbol%3Dvswaysfltdrg%26platform%3DWEB%26language%3Dzh%26currency%3DCNY&stylename=zf06_rtw015sw",
        "token": "f8c3de3d-1fea-4d7c-a8b0-29f63c4ab146"
    }
}
```

{% endtab %}

{% tab title="200: OK Unauthorised access" %}

```javascript
{
    "status": "SC_INVALID_OPERATOR",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456"
}
```

{% endtab %}

{% tab title="200: OK Verification failed" %}

```javascript
{
    "status": "SC_INVALID_SIGNATURE",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456"
}
```

{% endtab %}

{% tab title="200: OK Game is not supported" %}

```javascript
{
    "status": "SC_INVALID_GAME",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456"
}
```

{% endtab %}

{% tab title="200: OK Currency is not supported" %}

```javascript
{
    "status": "SC_WRONG_CURRENCY",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456"
}
```

{% endtab %}

{% tab title="200: OK Invalid request" %}

```javascript
{
    "status": "SC_INVALID_REQUEST",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "validation": {
        "username": "Invalid value."
    }
}
```

{% endtab %}

{% tab title="200: OK Unknown error" %}

```javascript
{
    "status": "SC_UNKNOWN_ERROR",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456"
}
```

{% endtab %}
{% endtabs %}

## Returns the list of supported vendors for the operator.

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>/game/vendors`

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                      | Type   | Description                                                                                     |
| ----------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark> | String | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request. |
| displayLanguage                           | String | The language code for localised Game Vendor name translation                                    |
| currency                                  | String | ISO-4217 currency code (eg. USD)                                                                |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
  "traceId": "3b37a2f9-f0c3-47d4-b396-ff8e1309a84d",
  "status": "SC_OK",
  "message": "Successful response.",
  "data": [
    {
      "name": "PP EN",
      "currencyCode": "PHP,BRL",   
      "code": "PP",
      "categoryCode": "SLOTS,LIVE"
    },
    {
      "name": "PG Soft",
      "currencyCode": "BRL",      
      "code": "PGS",
      "categoryCode": "SLOTS"
    },
    {
      "name": "CQ9",
      "currencyCode": "PHP,BRL",        
      "code": "CQ9",
      "categoryCode": "SLOTS"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

## Returns the list of supported games for the operator.

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>/game/list`

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                         | Type    | Description                                                                                     |
| -------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>    | String  | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request. |
| vendorCode<mark style="color:red;">\*</mark> | String  | Vendor's code                                                                                   |
| pageNo<mark style="color:red;">\*</mark>     | Integer | Page number                                                                                     |
| pageSize                                     | Integer | Page size. Default: 100                                                                         |
| displayLanguage                              | String  | The language code for localized Game name and images text translation                           |
| currency                                     | String  | ISO-4217 currency code (eg. USD)                                                                |

{% tabs %}
{% tab title="200: OK Response success" %}

````javascript
```json
{
    "traceId": "706bb933-0c18-4b79-bed9-bf0b99c724ee",
    "status": "SC_OK",
    "message": "Successful response.",
    "data": {
        "headers": {
            "gameCode": 0,
            "gameName": 1,
            "categoryCode": 2,
            "imageSquare": 3,
            "imageLandscape": 4,
            "languageCode": 5,
            "platformCode": 6,
            "currencyCode": 7
        },
        "games": [
            [
                "PP_1302",
                "Spaceman",
                "SLOTS",
                "https://cdn-dev.gasea168.com/game/PP/Spaceman.png",
                null,
                "en,hk,id,pt,th,vi,zh",
                "H5,WEB",
                "CNY,PHP"
            ],
            [
                "PP_bca",
                "Baccarat",
                "SLOTS",
                "https://cdn-dev.gasea168.com/game/PP/Baccarat.png",
                null,
                "en,hk,id,pt,th,vi,zh",
                "H5,WEB",
                "CNY,PHP"
            ],
            [
                "PP_bjma",
                "Multihand Blackjack",
                "SLOTS",
                "https://cdn-dev.gasea168.com/game/PP/Multihand Blackjack.png",
                null,
                "en,hk,id,pt,th,vi,zh",
                "H5,WEB",
                "CNY,PHP"
            ],
            [
                "PP_bjmb",
                "American Blackjack",
                "SLOTS",
                "https://cdn-dev.gasea168.com/game/PP/American Blackjack.png",
                null,
                "en,hk,id,pt,th,vi,zh",
                "H5,WEB",
                "CNY,PHP"   
            ],
            [
                "PP_bnadvanced",
                "Dragon Bonus Baccarat",
                "SLOTS",
                "https://cdn-dev.gasea168.com/game/PP/Dragon Bonus Baccarat.png",
                null,
                "en,hk,id,pt,th,vi,zh",
                "H5,WEB",
                "CNY,PHP" 
            ]
        ],
        "currentPage": 1,
        "totalItems": 316,
        "totalPages": 64
    }
}
```
````

{% endtab %}
{% endtabs %}

## Terminates a player's game session.

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>/game/terminate`

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                       | Type   | Description                                                                                     |
| ------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>  | String | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request. |
| username<mark style="color:red;">\*</mark> | String | The username of the user in the operator's system.                                              |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "traceId": "639cb889-1a49-448b-a1e0-82e9d2ecacb5",
    "status": "SC_OK",
    "message": "Successful response."
}
```

{% endtab %}
{% endtabs %}

## Wallet API

## Retrieve user's latest balance.

<mark style="color:green;">`POST`</mark> `https://<operator_site>/wallet/balance`

Implemented by Operator. The Game Aggregator will call this endpoint to retrieve the user's latest wallet balance.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                       | Type   | Description                                                                                           |
| ------------------------------------------ | ------ | ----------------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>  | String | A Universally Unique Identifier (UUID) provided by the Game Aggregator's system for each API request. |
| username<mark style="color:red;">\*</mark> | String | The username of the user in the Operator's system.                                                    |
| currency<mark style="color:red;">\*</mark> | String | ISO-4217 currency code (eg. USD)                                                                      |
| token<mark style="color:red;">\*</mark>    | String | User's session token generated by Game Aggregator.                                                    |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_OK",
    "data": {
        "username": "bob12345",
        "currency": "USD",
        "balance": 100.00
    }
}
```

{% endtab %}

{% tab title="200: OK User does not exists" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_USER_NOT_EXISTS"
}
```

{% endtab %}

{% tab title="200: OK Invalid token" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INVALID_TOKEN"
}
```

{% endtab %}

{% tab title="200: OK Invalid signature" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INVALID_SIGNATURE"
}
```

{% endtab %}

{% tab title="200: OK Wrong currency" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_WRONG_CURRENCY"
}
```

{% endtab %}

{% tab title="200: OK Invalid request" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_WRONG_PARAMETERS"
}
```

{% endtab %}
{% endtabs %}

## A bet transaction to deduct amount from the wallet balance.

<mark style="color:green;">`POST`</mark> `https://<operator_site>/wallet/bet`

Called by the Game Aggregator when the user performs a bet.\
The Operator is expected to deduct the given `amount` from user's wallet and returns the latest balance.

Each bet transaction is identified by `transactionId`, Operator is expected to validate that the bet transaction is not processed before.

<mark style="color:red;">**Important**</mark>: This API call is idempotent, multiple calls with the same `transactionId` should not be processed again and return the latest balance of the user (SC\_OK) if the Operator has successfully processed the transaction before.

Currently, this API only applies to Pragmatic Play & CQ9 game vendors.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                                    | Type    | Description                                                                                           |
| ------------------------------------------------------- | ------- | ----------------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>               | String  | A Universally Unique Identifier (UUID) provided by the Game Aggregator's system for each API request. |
| username<mark style="color:red;">\*</mark>              | String  | The username of the user in the Operator's system.                                                    |
| transactionId<mark style="color:red;">\*</mark>         | String  | A unique Id that identifies this transaction.                                                         |
| betId<mark style="color:red;">\*</mark>                 | String  | A unique Id that identifies this bet request transaction                                              |
| externalTransactionId<mark style="color:red;">\*</mark> | String  | An external transaction Id provided by Game Vendors.                                                  |
| amount<mark style="color:red;">\*</mark>                | Decimal | Amount of the bet transaction                                                                         |
| currency<mark style="color:red;">\*</mark>              | String  | ISO-4217 currency code representing the currency used for this transaction.                           |
| token<mark style="color:red;">\*</mark>                 | String  | User's session token generated by Game Aggregator.                                                    |
| gameCode<mark style="color:red;">\*</mark>              | String  | A unique game identifier in Game Aggregator system.                                                   |
| roundId<mark style="color:red;">\*</mark>               | String  | Game round Id for grouping all bets and wins in a single round.                                       |
| timestamp                                               | Number  | Unix timestamp of this transaction in milliseconds.                                                   |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_OK",
    "data": {
        "username": "bob12345",
        "currency": "USD",
        "balance": 100.00
    }
}
```

{% endtab %}

{% tab title="200: OK Invalid signature" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INVALID_SIGNATURE"
}
```

{% endtab %}

{% tab title="200: OK Invalid token" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INVALID_TOKEN"
}
```

{% endtab %}

{% tab title="200: OK User does not exists" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_USER_NOT_EXISTS"
}
```

{% endtab %}

{% tab title="200: OK Wrong currency" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456,
    "status": "SC_WRONG_CURRENCY"
}
```

{% endtab %}

{% tab title="200: OK Invalid request" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INVALID_REQUEST"
}
```

{% endtab %}

{% tab title="200: OK Insufficient funds" %}

```javascript
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_INSUFFICIENT_FUNDS"
}
```

{% endtab %}
{% endtabs %}

## A bet transaction request to add and/or deduct funds from the user balance.

<mark style="color:green;">`POST`</mark> `https://<operator_site>/wallet/bet_result`

Called by the Game Aggregator when the user performs a bet or receives a bet result.\
The Operator is expected to update the user's wallet balance based on the `resultType` and return the final balance.

<mark style="color:red;">**Important**</mark>: This API call is idempotent, multiple calls with the same `transactionId` should not be processed again and return the latest balance of the user (SC\_OK) if the Operator has successfully processed the transaction before.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                                    | Type          | Description                                                                                                                                                                                                                                                                                                                               |
| ------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>               | String        | A Universally Unique Identifier (UUID) provided by the Game Aggregator's system for each API request.                                                                                                                                                                                                                                     |
| username<mark style="color:red;">\*</mark>              | String        | The username of the user in the Operator's system.                                                                                                                                                                                                                                                                                        |
| transactionId<mark style="color:red;">\*</mark>         | String        | A unique Id that identifies this transaction.                                                                                                                                                                                                                                                                                             |
| betId<mark style="color:red;">\*</mark>                 | String        | A unique Id that identifies this bet request transaction                                                                                                                                                                                                                                                                                  |
| externalTransactionId<mark style="color:red;">\*</mark> | String        | An external transaction Id provided by Game Vendors.                                                                                                                                                                                                                                                                                      |
| roundId<mark style="color:red;">\*</mark>               | String        | Game round Id for grouping all bets and wins in a single round.                                                                                                                                                                                                                                                                           |
| betAmount<mark style="color:red;">\*</mark>             | Decimal       | Amount of the bet transaction.                                                                                                                                                                                                                                                                                                            |
| winAmount<mark style="color:red;">\*</mark>             | Decimal       | Amount of the win, Operator is expected to add `winAmount` to user's wallet when the `winAmount` is more than 0.                                                                                                                                                                                                                          |
| effectiveTurnover<mark style="color:red;">\*</mark>     | Decimal       | Amount of the effective turnover                                                                                                                                                                                                                                                                                                          |
| winLoss<mark style="color:red;">\*</mark>               | Decimal       | Amount of the absolute Win or Loss                                                                                                                                                                                                                                                                                                        |
| jackpotAmount                                           | Decimal       | Amount of the Jackpot, Operator is expected to add `jackpotAmount` to user's wallet when `jackpotAmount` is more than 0.                                                                                                                                                                                                                  |
| resultType<mark style="color:red;">\*</mark>            | String        | <p>The type of transaction process</p><p>1) "WIN" - (Player wins a bet)</p><p>2) "BET\_WIN" - (Player places a bet and win)</p><p>3) "BET\_LOSE" - (Player places a bet and lose)</p><p>4) "LOSE" - (Player loses a bet)</p><p>5) "END" - (To notify Operator that the round has ended for a bet, no operation on wallet is required)</p> |
| isFreespin<mark style="color:red;">\*</mark>            | Integer (0,1) | The status to indicate the bet is a free spin bet                                                                                                                                                                                                                                                                                         |
| isEndRound<mark style="color:red;">\*</mark>            | Integer (0,1) | The status to indicate the bet is completed                                                                                                                                                                                                                                                                                               |
| currency<mark style="color:red;">\*</mark>              | String        | ISO-4217 currency code representing the currency used for this transaction.                                                                                                                                                                                                                                                               |
| token<mark style="color:red;">\*</mark>                 | String        | User's session token generated by Game Aggregator.                                                                                                                                                                                                                                                                                        |
| gameCode<mark style="color:red;">\*</mark>              | String        | A unique game identifier in Game Aggregator system.                                                                                                                                                                                                                                                                                       |
| betTime<mark style="color:red;">\*</mark>               | Number        | The initial request Unix timestamp of this transaction in milliseconds.                                                                                                                                                                                                                                                                   |
| settledTime                                             | Number        | The bet settlement Unix timestamp of this transaction in milliseconds.                                                                                                                                                                                                                                                                    |

{% tabs %}
{% tab title="200: OK Response success" %}

```
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_OK",
    "data": {
        "username": "bob12345",
        "currency": "USD",
        "balance": 100.00
    }
}
```

{% endtab %}
{% endtabs %}

## A rollback action on a bet transaction

<mark style="color:green;">`POST`</mark> `https://<operator_site>/wallet/rollback`

Called by the Game Aggregator to reverse a previous bet transaction.\
The Operator is expected to find the previous bet transaction based on the given `betId` to roll back its effect (credit/debit) to the user balance and return the latest balance.

<mark style="color:red;">**Important**</mark>: This API call is idempotent, multiple calls with the same `transactionId` should not be processed again and return the latest balance of the user (SC\_OK) if the Operator has successfully processed the transaction before.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                                    | Type   | Description                                                                                           |
| ------------------------------------------------------- | ------ | ----------------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>               | String | A Universally Unique Identifier (UUID) provided by the Game Aggregator's system for each API request. |
| transactionId<mark style="color:red;">\*</mark>         | String | A unique Id that identifies this transaction.                                                         |
| betId<mark style="color:red;">\*</mark>                 | String | A bet transaction Id to roll back its affected (credit/debit) to the user balance.                    |
| externalTransactionId<mark style="color:red;">\*</mark> | String | An external transaction Id provided by Game Vendors.                                                  |
| roundId<mark style="color:red;">\*</mark>               | String | Game round Id for grouping all bets and wins in a single round.                                       |
| gameCode<mark style="color:red;">\*</mark>              | String | A unique game identifier in Game Aggregator system.                                                   |
| username<mark style="color:red;">\*</mark>              | String | The username of the user in the Operator's system.                                                    |
| currency<mark style="color:red;">\*</mark>              | String | ISO-4217 currency code representing the currency used for this transaction.                           |
| timestamp                                               | Number | Unix timestamp of this transaction in milliseconds.                                                   |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "status": "SC_OK",
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "data": {
        "username": "bob12345",
        "currency": "USD",
        "balance": 100.00
    }
}
```

{% endtab %}
{% endtabs %}

## An adjustment on the win amount of a game round.

<mark style="color:green;">`POST`</mark> `https://<operator_site>/wallet/adjustment`

Called by the Game Aggregator to adjust a previous round of the bet transaction win/loss result. The Operator is expected to **add** or **deduct** the given amount on the user's wallet and returns the latest balance.

<mark style="color:red;">**This API only applies to Live and Sport game categories.**</mark>

<mark style="color:red;">**Important**</mark>: This API call is idempotent, multiple calls with the same `transactionId` should not be processed again and return the latest balance of the user (SC\_OK) if the Operator has successfully processed the transaction before.

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                                    | Type    | Description                                                                                                          |
| ------------------------------------------------------- | ------- | -------------------------------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>               | String  | A Universally Unique Identifier (UUID) provided by the Game Aggregator's system for each API request.                |
| username<mark style="color:red;">\*</mark>              | String  | The username of the user in the Operator's system.                                                                   |
| transactionId<mark style="color:red;">\*</mark>         | String  | A unique Id that identifies this transaction.                                                                        |
| externalTransactionId<mark style="color:red;">\*</mark> | String  | An external transaction Id provided by Game Vendors.                                                                 |
| roundId<mark style="color:red;">\*</mark>               | String  | Game round Id for the previous transaction to be adjusted                                                            |
| amount<mark style="color:red;">\*</mark>                | Decimal | <p>Amount to be adjusted for this transaction</p><p>1) positive (add balance)</p><p>2) negative (deduct balance)</p> |
| currency<mark style="color:red;">\*</mark>              | String  | ISO-4217 currency code representing the currency used for this transaction.                                          |
| gameCode<mark style="color:red;">\*</mark>              | String  | A unique game identifier in Game Aggregator system.                                                                  |
| timestamp                                               | Number  | Unix timestamp of this transaction in milliseconds.                                                                  |

{% tabs %}
{% tab title="200: OK Response success" %}

```
{
    "traceId": "f8c3de3d-1fea-4d7c-a8b0-29f63c4c3456",
    "status": "SC_OK",
    "data": {
        "username": "bob12345",
        "currency": "USD",
        "balance": 100.00
    }
}
```

{% endtab %}
{% endtabs %}

## Transactions API

## Returns the list of transactions by a specific time period.

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>/transaction/list`&#x20;

The game operator will get a list of transaction history by searching the transaction bet time&#x20;

Bet Status definition:&#x20;

0 = Unsettled Bet

1 = Settled Bet

2 = Cancelled Bet

3 = Refunded Bet

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                       | Type    | Description                                                                                     |
| ------------------------------------------ | ------- | ----------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark>  | String  | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request. |
| fromTime<mark style="color:red;">\*</mark> | Long    | The timestamp to retrieve transactions from.                                                    |
| toTime<mark style="color:red;">\*</mark>   | Long    | To retrieve transactions up to this timestamp.                                                  |
| pageNo<mark style="color:red;">\*</mark>   | Integer | Page number.                                                                                    |
| pageSize                                   | Integer | Page size. Default: 2000, Max: 5000                                                             |

{% tabs %}
{% tab title="200: OK Response success" %}

```javascript
{
    "traceId": "04cb48ce-346f-4dcc-ae49-7955805c50fc",
    "status": "SC_OK",
    "message": "Successful response.",
    "data": {
        "headers": {
            "betId": 0,
            "roundId": 1,
            "externalTransactionId": 2,
            "username": 3,
            "currencyCode": 4,
            "gameCode": 5,
            "vendorCode": 6,
            "gameCategoryCode": 7,
            "betAmount": 8,
            "winAmount": 9,
            "winLoss": 10,
            "effectiveTurnover": 11,
            "jackpotAmount": 12,
            "refundAmount": 13,
            "status": 14,
            "vendorBetTime": 15,
            "vendorSettleTime": 16,
            "isFreeSpin": 17
        },
        "transactions": [
            [
                "3358049710",
                "8865512900",
                "8865512900",
                "alex50",
                "CNY",
                "PP_vs7monkeys",
                "PP",
                "SLOTS",
                5.6000,
                11.0000,
                5.4000,
                5.6000,
                0.0000,
                0.0000,
                2,
                1681467405636,
                1681467405862,
                "TRUE"          
            ]
        ],
        "currentPage": 1,
        "totalItems": 0,
        "totalPages": 0
    }
}
```

{% endtab %}
{% endtabs %}

## Returns the detail transaction info for a specific bet transaction&#x20;

<mark style="color:green;">`POST`</mark> `https://<oneapi_site>transaction/detail`

The game operator will get a single transaction history detail by searching the transactionId with/without the bet history detail url provided by Game Vendor

Bet Status definition:&#x20;

0 = Unsettled Bet

1 = Settled Bet

2 = Cancelled Bet

3 = Refunded Bet

#### Headers

| Name                                           | Type   | Description                                                                                                               |
| ---------------------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Content-Type<mark style="color:red;">\*</mark> | String | application/json                                                                                                          |
| X-API-Key<mark style="color:red;">\*</mark>    | String | Operator's API key                                                                                                        |
| X-Signature<mark style="color:red;">\*</mark>  | String | A digital signature generated using HMAC-SHA256 algorithm signed using the operator's API secret key on the request body. |

#### Request Body

| Name                                      | Type   | Description                                                                                     |
| ----------------------------------------- | ------ | ----------------------------------------------------------------------------------------------- |
| traceId<mark style="color:red;">\*</mark> | String | A Universally Unique Identifier (UUID) generated by the Operator's system for each API request. |
| betId<mark style="color:red;">\*</mark>   | String | The unique Id that identifies this bet request transaction                                      |
| displayLanguage                           | String | The language code for localised Game Vendor bet detail Url translation                          |

{% tabs %}
{% tab title="200: OK Response success" %}

```json
{
    "traceId": "6caee2f4-f636-449d-be67-e81d63394dd0",
    "status": "SC_OK",
    "message": "Successful response.",
    "data": {
        "detailUrl": "https://public.pg-redirect.net/history/redirect.html?trace_id=64591026-ec82-4b76-9cca-958bfce047d3&t=7D1DE1DD-883F-44BA-8003-5312F15024CF&psid=1646444472307331072&sid=1646444515999514624&lang=zh&type=operator",
        "betDetail": {
            "betId": "1646444515999514624",
            "externalTransactionId": "1646444515999514624",
            "roundId": "1646444472307331072",
            "username": "dfasdfgasdfasdf",
            "currencyCode": "CNY",
            "gameCode": "PGS_100",
            "vendorCode": "PGS",
            "gameCategoryCode": "SLOTS",
            "betAmount": 1010.0000,
            "winAmount": 0.0000,
            "winLoss": -1010.0000,
            "effectiveTurnover": 1010.0000,
            "jackpotAmount": 0.0000,
            "refundAmount": 0.0000,
            "status": 2,
            "isFreeSpin": "TRUE",
            "vendorBetTime": 1672985880016,
            "vendorSettleTime": 1672985880016
        }
    }
}
```

{% endtab %}
{% endtabs %}
