> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cog888.net/llms.txt
> Use this file to discover all available pages before exploring further.

# Wallet API 說明

> Wallet API 請求與回應格式說明

Wallet-API 是為變更玩家餘額而向 vendor 請求的 API，由 vendor 實作。

## Body 格式

### Request 參數說明

| 參數           | 說明                              | 型態              |
| ------------ | ------------------------------- | --------------- |
| platform\_id | 渠道號                             | String (5)      |
| token        | 驗證碼，對 params 和錢包金鑰 hash md5 的結果 | String (32)     |
| uuid         | 自定義的唯一性請求序號                     | String (32-128) |

### 驗證碼說明

驗證碼 `token` 是對請求參數的指定欄位取值添加錢包金鑰 hash md5 的結果。

下述以錢包金鑰 `52342182001A068859C20EB08F738839` 舉例說明：

**Request example 1:**

`/api/callback/balance` 的指定欄位為 `platform_id`、`uuid`、`account`

```json theme={null}
{
    "platform_id": "AXTES",
    "token": "F661C3377E67D65841C21F6A0D23B4D0",
    "timestamp": 1705976933889,
    "uuid": "e69da788a6c841d4953c475fc42bf464",
    "account": "walter123"
}
```

Request token: 取值 (platform\_id + uuid + account)，得到 `AXTESe69da788a6c841d4953c475fc42bf464walter123`，添加錢包金鑰後，hash md5 結果為 `F661C3377E67D65841C21F6A0D23B4D0`。

***

**Request example 2:**

`/dt/callback/apply_reserved` 的指定欄位為 `platform_id`、`uuid`、`account`、`type`、`credit`、`proposal_id`、`transaction_id`、`secret_key`

```json theme={null}
{
    "platform_id": "AXTES",
    "token": "286AEF636115802EF88A761B20228ADE",
    "timestamp": 1705976933889,
    "uuid": "e69da788a6c841d4953c475fc42bf464",
    "account": "walter123",
    "type": 1,
    "credit": 2000,
    "proposal_id": 954654,
    "transaction_id": "556-20240101AC152233"
}
```

Request token: 取值 (platform\_id + uuid + account + type + credit + proposal\_id + transaction\_id + secret\_key)，得到 `AXTESe69da788a6c841d4953c475fc42bf464walter12312000954654556-20240101AC15223352342182001A068859C20EB08F738839`，最後添加錢包金鑰並 hash md5 結果為 `286aef636115802ef88a761b20228ade`。

***

### Response 參數說明

| 參數        | 說明           | 型態              |
| --------- | ------------ | --------------- |
| code      | 錯誤代碼         | Number          |
| message   | 錯誤訊息         | String          |
| uuid      | 自定義的唯一性請求序號  | String (32-128) |
| timestamp | UNIX time，毫秒 | Number          |
| data      | 回傳資料         | Object          |

**Response example:**

```json theme={null}
{
    "code": 0,
    "message": "success",
    "uuid": "e69da788a6c841d4953c475fc42bf464",
    "timestamp": 1668580007001,
    "data": {
        "account": "tony88888",
        "platform_id": "AXTES",
        "credit": 115,
        "reserved": 100,
        "balance": 215
    }
}
```
