跳轉到主要內容

SyncCredit API 共用 Payload 結構

所有類型都使用相同的 dt/callback/sync_credit API,Payload 格式如下:
{
  "platform_id": "產品代碼",
  "uuid": "唯一識別碼",
  "account": "玩家帳號",
  "token": "MD5 驗證碼",
  "info": [
    {
      "type": 異動類型編號,
      "credit": 額度變化 (正=入款, 負=扣款),
      "order_id": "注單編號",
      "canceled_id": "被取消的交易ID (僅取消類使用)",
      "transaction_id": "交易ID",
      "proposal_id": "提案號",
      "ip": "玩家IP",
      "target_wallet": 目標錢包 (0=一般, 1=傳統提案錢包),
      "rolling_unit": 轉碼單位,
      "ratio": 寄碼,
      "order_detail": {
        "room_account": "廳帳號",
        "in_proposal": 是否在傳統提案中 (1=否, 2=是),
        "table_id": "桌台ID",
        "gmcode": "局號",
        "game_type": "遊戲類型",
        "play_type": 玩法,
        "amount": 投注金額,
        "valid_amount": 有效投注額,
        "win": 輸贏值,
        "flag": 狀態標記,
        "create_time": 建立時間,
        "reckon_time": 結算時間,
        "last_update_time": 最後更新時間,
        "round_detail": "局結果詳情"
      }
    }
  ]
}

各類型關鍵差異

類型credit 方向canceled_id特殊處理
8 派彩正值(贏)或 0(輸)正常結算,包含輸贏金額
10 重算局差額(可正可負)因現場異常,系統後台調整原派彩差額
11 取消局正值(退還投注)因現場異常,系統後台退還所有該局投注
12 添增注單贏面為正,輸面為負,即輸贏值因現場異常,系統後台添加注單,有直接為結算狀態
13 取消注單正值(退還投注)因現場異常,系統後台取消注單
23 下注失敗還款正值原交易 ID投注方未收到下注的回覆,該筆交易不成立。貴幣需核對原交易 ID 是否有執行過下注扣款,有執行過的話需要回滾
26 修改注單差額(可正可負)1. 只有傳統注單會操作,因現場異常,系統後台修改注單 2. 用來更新對沖有效投注額
29 額度回沖正值原交易 ID通用回沖機制,用於對費失敗等場景,跟 type 23 類似,代表投注方未收到扣款的回覆,該筆交易不成立,貴幣需核對原交易 ID 是否有執行過扣款,有執行過的話需要回滾

額外說明:Type 26 對沖同步機制

在測試案例一中,派彩 (Type 8) 和重算局 (Type 10) 都會伴隨額外的 Type 26 (credit=0) 記錄。這是因為對沖計算 (Hedge Calculation) 機制。

觸發條件

當玩家在同一局有對沖投注(例如同時買莊和買閒)時,系統在派彩或重算時會自動產生 Type 26 記錄:
遊戲類型對沖玩法
百家樂 (BAC) / 牛牛 (NIU)playtype 1 (莊) ↔ playtype 2 (閒)
輪盤 (ROU)playtype 151-156 之間互為對沖
點數百家樂 (DTB)多組對沖玩法 (1↔2, 4↔5, 6↔7, 8↔9, 10↔11)

邏輯說明

當處理有對沖注單的派彩/重算時,系統會:
  1. 檢查同一局是否有對沖注單存在
  2. 若有對沖,則重新計算雙方的有效投注額 (valid_amount)
  3. 插入 Type 26 記錄通知單一錢包方 valid_amount 的變化

Type 26 對沖同步的欄位

欄位說明
type26修改注單
credit固定為 0不影響額度,僅同步有效投注額
valid_amount調整後的值重新計算後的有效投注額

範例

案例一中同時下注「買莊 100」和「買閒 100」,這兩筆互為對沖:
  • 處理買莊 (playtype=1) 的派彩時 → 產生買閒的 Type 26 (credit=0)
  • 處理買閒 (playtype=2) 的派彩時 → 產生買莊的 Type 26 (credit=0)

測試案例

案例一:正常流程 → 重算局 → 取消局

涵蓋類型:8 派彩、10 重算局、11 取消局 開牌設定:
  • 原始開牌(莊贏):閒 [♠ 2, ♥3] = 5 點,莊 [♦K, ♣9] = 9 點 → 莊贏
  • 重算開牌(閒贏):閒 [♠ 9, ♥8] = 7 點,莊 [♦4, ♣2] = 6 點 → 閒贏
步驟動作Typecredit說明
1下注 100 買莊7-100扣款
2下注 100 買閒7-100扣款
3開牌莊贏,派彩8+200買莊贏(1:1,退還本金+獎金)
4(同上)80買閒輸
5後台重算為閒贏10-200買莊(原贏變輸,扣回派彩)
6(同上)10+200買閒(原輸變贏,補發派彩)
7後台取消局11+100退還買莊
8(同上)11+100退還買閒
Payload:
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      "type": 7,
      "credit": -100,
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-260123191230-0000001",
      "proposal_id": "958936",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "gmcode": "9D13261231KK",
        "game_type": "BAC_CF",
        "table_id": "9D13",
        "room_account": "9D"
      }
    },
    {
      "type": 7,
      "credit": -100,
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-260123191230-0000002",
      "proposal_id": "958936",
      "order_detail": {
        "play_type": 2,
        "amount": 100,
        "gmcode": "9D13261231KK",
        "game_type": "BAC_CF",
        "table_id": "9D13",
        "room_account": "9D"
      }
    }
  ]
}
以下為同一個 API 請求,info 陣列包含多個 Object,請依序處理。
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      // [1] 買莊派彩:贏 100(退還本金 100 + 獎金 100 = 200)
      "type": 8,
      "credit": 200,
      "canceled_id": "",
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-1-bac.9d-260123191950",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "valid_amount": 100,
        "win": 100,
        "flag": 1,
        "round_detail": "34 51;13 25|3|9|5|0"
      }
    },
    {
      // [2] 對沖同步:更新買莊的有效投注額為 0(因跟買閒對沖)
      "type": 26,
      "credit": 0,
      "canceled_id": "",
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-1-lobby1-260123191952",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "valid_amount": 0,
        "win": 100,
        "flag": 1,
        "round_detail": "34 51;13 25|3|9|5|0"
      }
    },
    {
      // [3] 買閒派彩:輸 100(credit=0,下注時已扣款)
      "type": 8,
      "credit": 0,
      "canceled_id": "",
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-2-bac.9d-260123191950",
      "order_detail": {
        "play_type": 2,
        "amount": 100,
        "valid_amount": 0,
        "win": -100,
        "flag": 1,
        "round_detail": "34 51;13 25|3|9|5|0"
      }
    }
  ]
}
以下為同一個 API 請求,info 陣列包含多個 Object,請依序處理。
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      // [1] 對沖同步:更新買閒的有效投注額
      "type": 26,
      "credit": 0,
      "canceled_id": "",
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-2-lobby1-260123193239",
      "order_detail": {
        "play_type": 2,
        "amount": 100,
        "valid_amount": 0,
        "win": -100,
        "flag": 1,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    },
    {
      // [2] 買莊重算:原本贏變輸,扣回派彩 200
      "type": 10,
      "credit": -200,
      "canceled_id": "",
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-1-bac.9d-260123193239",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "valid_amount": 0,
        "win": -100,
        "flag": 1,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    },
    {
      // [3] 對沖同步:更新買莊的有效投注額
      "type": 26,
      "credit": 0,
      "canceled_id": "",
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-1-lobby1-260123193239",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "valid_amount": 0,
        "win": -100,
        "flag": 1,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    },
    {
      // [4] 買閒重算:原本輸變贏,補發派彩 200
      "type": 10,
      "credit": 200,
      "canceled_id": "",
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-2-bac.9d-260123193239",
      "order_detail": {
        "play_type": 2,
        "amount": 100,
        "valid_amount": 0,
        "win": 100,
        "flag": 1,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    }
  ]
}
以下為同一個 API 請求,info 陣列包含多個 Object,請依序處理。
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      // [1] 對沖同步:更新買閒的有效投注額
      "type": 26,
      "credit": 0,
      "canceled_id": "",
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-2-lobby1-260123194449",
      "order_detail": {
        "play_type": 2,
        "amount": 100,
        "valid_amount": 100,
        "win": 100,
        "flag": 1,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    },
    {
      // [2] 取消買莊:退還投注額 100(flag=-8 表示已取消)
      "type": 11,
      "credit": 100,
      "canceled_id": "",
      "order_id": "9D13260123191230010000001",
      "transaction_id": "9D13260123191230010000001-1-bac.9d-260123194448",
      "order_detail": {
        "play_type": 1,
        "amount": 0,
        "valid_amount": 0,
        "win": 0,
        "flag": -8,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    },
    {
      // [3] 取消買閒:扣回已派彩金額 100(flag=-8 表示已取消)
      "type": 11,
      "credit": -100,
      "canceled_id": "",
      "order_id": "9D13260123191230020000002",
      "transaction_id": "9D13260123191230020000002-2-bac.9d-260123194448",
      "order_detail": {
        "play_type": 2,
        "amount": 0,
        "valid_amount": 0,
        "win": 0,
        "flag": -8,
        "round_detail": "41 56;4 18|4|6|7|0"
      }
    }
  ]
}

案例二:正常流程 → 取消注單

涵蓋類型:8 派彩、13 取消注單 開牌設定:
  • 開牌(莊贏):閒 [♠ 4, ♥2] = 6 點,莊 [♦7, ♣K] = 7 點 → 莊贏
步驟動作Typecredit說明
1下注 100 買莊7-100扣款
2開牌莊贏,派彩8+200贏面(1:1,退還本金+獎金)
3後台取消該注單13-100扣回差額(已派彩 200 - 退還投注 100 = 扣回 100)
Payload:
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      "type": 7,
      "credit": -100,
      "order_id": "9D13260123195630010000004",
      "transaction_id": "9D13260123195630010000004-260123195630-0000004",
      "proposal_id": "958936",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "gmcode": "9D13261231KO",
        "game_type": "BAC_CF",
        "table_id": "9D13",
        "room_account": "9D"
      }
    }
  ]
}
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      "type": 8,
      "credit": 200,
      "canceled_id": "",
      "order_id": "9D13260123195630010000004",
      "transaction_id": "9D13260123195630010000004-1-bac.9d-260123195703",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "valid_amount": 100,
        "win": 100,
        "flag": 1,
        "round_detail": "36 50;7 29|3|7|6|0"
      }
    }
  ]
}
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      // 取消注單:扣回差額 100(已派彩 200,取消後需扣回 100)
      "type": 13,
      "credit": -100,
      "canceled_id": "",
      "order_id": "9D13260123195630010000004",
      "transaction_id": "9D13260123195630010000004-1-bac.9d-260123195728",
      "order_detail": {
        "play_type": 1,
        "amount": 0,
        "valid_amount": 0,
        "win": 0,
        "flag": -8,
        "round_detail": "36 50;7 29|3|7|6|0"
      }
    }
  ]
}

案例三:下注 → 下注失敗還款

涵蓋類型:23 下注失敗還款
步驟動作Typecreditcanceled_id
1下注 100(模擬未收到回覆)7-100-
2觸發下注失敗還款23+100步驟1的交易ID
Payload:
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      "type": 7,
      "credit": -100,
      "order_id": "9D13260123200228010000005",
      "transaction_id": "9D13260123200228010000005-260123200228-0000005",
      "proposal_id": "958936",
      "order_detail": {
        "play_type": 1,
        "amount": 100,
        "gmcode": "9D13261231KQ",
        "game_type": "BAC_CF",
        "table_id": "9D13",
        "room_account": "9D"
      }
    }
  ]
}
{
  "account": "st",
  "platform_id": "H88",
  "info": [
    {
      // 下注失敗還款:canceled_id 為原下注的 transaction_id
      "type": 23,
      "credit": 100,
      "canceled_id": "9D13260123200228010000005-260123200228-0000005",
      "order_id": "9D13260123200228010000005",
      "transaction_id": "9D13260123200228010000005-260123200228-0000005RB",
      "order_detail": {
        "play_type": 1,
        "amount": 0,
        "valid_amount": 0,
        "win": 0,
        "flag": 0,
        "round_detail": ""
      }
    }
  ]
}

測試總結

案例涵蓋類型
案例一8, 10, 11, 26
案例二8, 13
案例三23