> ## 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.

# 更新額度

> 更新玩家遊戲額度

<Accordion title="此 API 可能返回的錯誤代碼">
  | 代碼   | 說明     |
  | ---- | ------ |
  | 1    | 額度不足   |
  | 2    | 無效參數   |
  | 10   | 交易序號重複 |
  | 36   | 伺服器錯誤  |
  | 9999 | 未知錯誤   |
</Accordion>


## OpenAPI

````yaml /transfer-openapi.json PUT /api/v1/dt/credit
openapi: 3.1.0
info:
  title: 轉帳錢包 API
  description: Game-API 用於 vendor 向遊戲取得遊戲相關數據
  version: 1.0.0
servers:
  - url: https://api.example.com
    description: Production server
security: []
paths:
  /api/v1/dt/credit:
    put:
      tags:
        - User API
      summary: 更新額度
      description: 更新玩家遊戲額度
      operationId: updateCredit
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - uuid
                - platform_id
                - username
                - transaction_id
                - credit
                - key
              properties:
                uuid:
                  type: string
                  description: 各平台自定義的唯一性請求序號，長度 >= 32 且 <= 128 字節
                platform_id:
                  type: string
                  description: 平台方的產品 ID
                username:
                  type: string
                  description: 用戶在遊戲中的帳號 (限制長度23字元，且皆為小寫英文或數字)
                transaction_id:
                  type: string
                  description: 交易序號 (長度 1~128 字元，僅允許 ASCII 32-126 可列印字元，禁止使用 ` 和 ~)
                credit:
                  type: string
                  description: 額度變化量（正數為加額，負數為扣額）
                key:
                  type: string
                  description: md5(username + credit + transaction_id + 平台密鑰)
      responses:
        '200':
          description: 成功 (無 response body)
          content: {}
        '400':
          description: 錯誤
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error:
                  code: 2
                  msg: >-
                    request hash signature(0FACF22B9E3DB5CDC670A0F7A65BB76A) is
                    error
                  uuid: 9e96610f-5388-42df-b3ed-ba1b3178c63b
components:
  schemas:
    Error:
      type: object
      properties:
        code:
          type: string
          description: 錯誤代碼
        message:
          type: string
          description: 錯誤訊息
        data:
          description: 資料（通常為 null）
        status_code:
          type: integer
          description: HTTP 狀態碼
        service:
          type: string
          description: 服務名稱

````