# 充值系統 - ClientAPI ## VerifyOrder - 驗證訂單 | 說明 | 驗證訂單狀態與訂單物品內容是否正確 | |:------ |:---------------------------------- | | URI | {ClientAPIURL}/billing/verifyOrder | | METHOD | POST | | HEADER | X-SIGN | 請求內容 ``` { "purchaseToken" : "bbb" -- 購買憑證, string, 必填 "productID" : "aaa" -- 產品ID, 必填 "osType" : 1 -- 作業系統ID, integer, 1:安卓, 2:蘋果, 必填 "itemType" : 1 -- 商品類型, integer, 1:一般商品, 2:訂閱型商品, 必填 "UserID" : 1007782 -- 平台的使用者ID } ``` 回應內容 ``` { "data": -- json { "orderID" : "12312", -- 訂單ID "productID" "123123", -- 商品ID "purchaseToken": "aabbcc" -- 訂單憑證, string, "isTestOrder" : 0 -- 是否為測試購買, 0: 否(真實購買), 1: 是(測試購買) } "code":0, -- ErrorCode, integer "msg": "" -- ErrorMessage, string } ``` ## ConfirmOrder - 通知訂單完成 | 說明 | 通知訂單完成 | |:------ |:----------------------------------- | | URI | {ClientAPIURL}/billing/confirmOrder | | METHOD | POST | | HEADER | X-SIGN | 請求內容 ``` { "purchaseToken" : "bbb" -- 購買憑證, string, 必填 "productID" : "aaa" -- 產品ID, 必填 "osType" : 1 -- 作業系統ID, integer, 1:安卓, 2:蘋果, 必填 "itemType" : 1 -- 商品類型, integer, 1:一般商品, 2:訂閱型商品, 必填 } ``` 回應內容 ``` { "code":0, -- ErrorCode, integer "msg": "" -- ErrorMessage, string } ``` ## CheckIAPAutoRenew - 自動續訂檢查 0. Schdeuler 每日固定時間發送請求 1. StartDate/EndDate 不為空時, 只檢查 StartDate/EndDate 時間區間內的訂單 2. 根據時間, 拿取 IAPProductRecord 內的訂閱商品資料, 並根據 IAPSubscribeProduct.SubscribeDays 與 IAPProductRecord.UpdateAt 決定是否向平台發送api請求 </br> a. 若訂閱商品已過週期, 並自動續訂, 呼叫SP_SendIAPItem | 說明 | 跟平台詢問是否有自動續訂的交易 | |:------ |:---------------------------------------- | | URI | {ClientAPIURL}/billing/checkIAPAutoRenew | | METHOD | POST | | HEADER | X-SIGN | 請求內容 ``` { "Days" : 7, -- Integer, optional, default(7), 檢查過去幾天的資料 "StartDateTime" : "2024-01-01", -- datetime, optional, "EndDateTime" : "2024-01-05", -- datetime, optional } ``` 回應內容 ``` { "code":0, -- ErrorCode, integer "msg": "" -- ErrorMessage, string } ``` ## CheckIAPRefund - 檢查退款訂單 0. Scheduler 每日固定時間呼叫 1. StartDate/EndDate 不為空時, 只檢查 StartDate/EndDate 時間區間內的訂單 2. 向平台發送請求後, 確認該筆訂單是否退款, 若是 -> 進行退款處理 | 說明 | 檢查是否有退款訂單, 並進行退款處裡 | |:------ |:------------------------------------- | | URI | {ClientAPIURL}/billing/checkIAPRefund | | METHOD | POST | | HEADER | X-SIGN | 請求內容 ``` { "Days" : 7, -- Integer, optional, default(7), 檢查過去幾天的資料 "StartDateTime" : "2024-01-01", -- datetime, optional, "EndDateTime" : "2024-01-05", -- datetime, optional } ``` 回應內容 ``` { "code":0, -- ErrorCode, integer "msg": "" -- ErrorMessage, string } ``` # 錯誤訊息列表 | 參數 | 型別 | |:---- |:--------------------------- | | 0 | 成功 | | 3000 | 程式錯誤/內部錯誤 | | 3001 | 找不到用戶 | | 3002 | 用戶已被停用 | | 3013 | 操作權限錯誤 | | 3014 | 請求參數錯誤 | | 3018 | 沒任何符合的獎勵/獎勵已領取 | | 3019 | REPEAT_REQUEST, 重複請求 | | 3023 | 發送請求失敗 | | 3024 | DB Query Fail. | | 3025 | Get AccessToken Fail | | 3150 | Order is PENDING |