{"openapi":"3.1.0","info":{"title":"t-gate · USDT 收付 API","description":"TRON 主網 USDT 收款、商戶餘額與人工核准下發。金額以十進位字串傳遞，最多六位小數。完整串接說明見首頁。","version":"1.0"},"paths":{"/v1/merchants":{"post":{"tags":["商戶"],"summary":"建立商戶並領取一次性顯示的金鑰","operationId":"signup_v1_merchants_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantRequest"}}},"required":true},"responses":{"201":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MerchantCreated"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}},"429":{"description":"全平台 300 秒開戶間隔，請依 Retry-After 重試","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}}}},"/v1/orders":{"post":{"tags":["收款"],"summary":"建立或取回收款單","operationId":"create_order_v1_orders_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}},"202":{"description":"已排隊，原單號重試","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderView"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/orders/{ref}":{"get":{"tags":["收款"],"summary":"依商戶訂單號查詢收款單","operationId":"get_order_v1_orders__ref__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":96,"pattern":"^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$","title":"Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}},"202":{"description":"等待配址","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderView"}}}}}}},"/v1/orders/{ref}/cancel":{"post":{"tags":["收款"],"summary":"取消可取消的收款單","operationId":"cancel_order_v1_orders__ref__cancel_post","security":[{"HTTPBearer":[]}],"parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":96,"pattern":"^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$","title":"Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/OrderView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}}}},"/v1/balance":{"get":{"tags":["商戶"],"summary":"查詢可用與保留 USDT 餘額","operationId":"balance_v1_balance_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BalanceView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/ledger":{"get":{"tags":["商戶"],"summary":"取得商戶帳務流水","operationId":"ledger_v1_ledger_get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"limit","in":"query","required":false,"schema":{"type":"integer","maximum":100,"minimum":1,"default":100,"title":"Limit"}},{"name":"before","in":"query","required":false,"schema":{"anyOf":[{"type":"integer","exclusiveMinimum":0},{"type":"null"}],"title":"Before"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LedgerView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}}}},"/v1/payouts":{"post":{"tags":["下發"],"summary":"申請下發並保留本金與服務費","operationId":"payout_v1_payouts_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}},"security":[{"HTTPBearer":[]}]}},"/v1/payouts/{ref}":{"get":{"tags":["下發"],"summary":"依商戶付款單號查詢下發","operationId":"get_payout_v1_payouts__ref__get","security":[{"HTTPBearer":[]}],"parameters":[{"name":"ref","in":"path","required":true,"schema":{"type":"string","minLength":1,"maxLength":96,"pattern":"^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$","title":"Ref"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PayoutView"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}}}},"/checkout":{"post":{"tags":["收銀台"],"summary":"以瀏覽器表單開啟已建立的收款單","operationId":"checkout_form_checkout_post","requestBody":{"content":{"application/x-www-form-urlencoded":{"schema":{"properties":{"checkout_token":{"type":"string"}},"additionalProperties":false,"type":"object","required":["checkout_token"]}}},"required":true},"responses":{"303":{"description":"導向同一張訂單的收銀台","headers":{"Location":{"schema":{"type":"string"}}}},"422":{"description":"請求欄位格式不符","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FailureView"}}}}}}}},"components":{"schemas":{"BalanceView":{"properties":{"available":{"type":"string","title":"Available"},"reserved":{"type":"string","title":"Reserved"},"total":{"type":"string","title":"Total"},"asset":{"type":"string","title":"Asset"},"network":{"type":"string","title":"Network"}},"type":"object","required":["available","reserved","total","asset","network"],"title":"BalanceView"},"FailureView":{"properties":{"error":{"type":"string","title":"Error"},"message":{"type":"string","title":"Message"},"retry_after_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Retry After Seconds"}},"type":"object","required":["error","message"],"title":"FailureView"},"LedgerEntry":{"properties":{"entry_id":{"type":"integer","title":"Entry Id"},"kind":{"type":"string","title":"Kind"},"order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Order Id"},"payout_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Payout Id"},"merchant_order_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Order Id"},"merchant_payout_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Merchant Payout Id"},"source":{"type":"string","title":"Source"},"gross":{"type":"string","title":"Gross"},"fee":{"type":"string","title":"Fee"},"net":{"type":"string","title":"Net"},"created_at":{"type":"string","title":"Created At"}},"type":"object","required":["entry_id","kind","order_id","payout_id","merchant_order_id","merchant_payout_id","source","gross","fee","net","created_at"],"title":"LedgerEntry"},"LedgerView":{"properties":{"entries":{"items":{"$ref":"#/components/schemas/LedgerEntry"},"type":"array","title":"Entries"},"next_before":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Next Before"}},"type":"object","required":["entries","next_before"],"title":"LedgerView"},"MerchantCreated":{"properties":{"merchant_id":{"type":"string","title":"Merchant Id"},"api_key":{"type":"string","title":"Api Key"},"webhook_secret":{"type":"string","title":"Webhook Secret"}},"type":"object","required":["merchant_id","api_key","webhook_secret"],"title":"MerchantCreated"},"MerchantRequest":{"properties":{"name":{"type":"string","maxLength":80,"minLength":1,"title":"Name"},"webhook_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Webhook Url"}},"additionalProperties":false,"type":"object","required":["name"],"title":"MerchantRequest"},"OrderRequest":{"properties":{"merchant_order_id":{"type":"string","maxLength":96,"minLength":1,"pattern":"^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$","title":"Merchant Order Id"},"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,11})(?:\\.[0-9]{1,6})?$","title":"Amount","examples":["100.00"]},"notify_url":{"anyOf":[{"type":"string","maxLength":2048},{"type":"null"}],"title":"Notify Url"}},"additionalProperties":false,"type":"object","required":["merchant_order_id","amount"],"title":"OrderRequest"},"OrderView":{"properties":{"order_id":{"type":"string","title":"Order Id"},"merchant_order_id":{"type":"string","title":"Merchant Order Id"},"merchant_name":{"type":"string","title":"Merchant Name"},"status":{"type":"string","enum":["queued","open","paid","expired","cancelled","adjusted"],"title":"Status"},"amount":{"type":"string","title":"Amount"},"paid_amount":{"type":"string","title":"Paid Amount"},"fee":{"type":"string","title":"Fee"},"net_amount":{"type":"string","title":"Net Amount"},"difference":{"type":"string","title":"Difference"},"fully_paid":{"type":"boolean","title":"Fully Paid"},"is_late":{"type":"boolean","title":"Is Late"},"accepting_payment":{"type":"boolean","title":"Accepting Payment"},"checkout_url":{"type":"string","title":"Checkout Url"},"checkout_token":{"type":"string","title":"Checkout Token"},"deposit_address":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Deposit Address"},"created_at":{"type":"string","title":"Created At"},"allocated_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Allocated At"},"expires_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Expires At"},"release_at":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Release At"},"retry_after_seconds":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Retry After Seconds"}},"type":"object","required":["order_id","merchant_order_id","merchant_name","status","amount","paid_amount","fee","net_amount","difference","fully_paid","is_late","accepting_payment","checkout_url","checkout_token","deposit_address","created_at","allocated_at","expires_at","release_at","retry_after_seconds"],"title":"OrderView"},"PayoutRequest":{"properties":{"merchant_payout_id":{"type":"string","maxLength":96,"minLength":1,"pattern":"^[A-Za-z0-9_-][A-Za-z0-9_.:-]*$","title":"Merchant Payout Id"},"to_address":{"type":"string","pattern":"^T[1-9A-HJ-NP-Za-km-z]{33}$","title":"To Address"},"amount":{"type":"string","pattern":"^(?:0|[1-9][0-9]{0,11})(?:\\.[0-9]{1,6})?$","title":"Amount","examples":["100.00"]}},"additionalProperties":false,"type":"object","required":["merchant_payout_id","to_address","amount"],"title":"PayoutRequest"},"PayoutView":{"properties":{"payout_id":{"type":"string","title":"Payout Id"},"merchant_payout_id":{"type":"string","title":"Merchant Payout Id"},"to_address":{"type":"string","title":"To Address"},"amount":{"type":"string","title":"Amount"},"fee":{"type":"string","title":"Fee"},"total":{"type":"string","title":"Total"},"status":{"type":"string","enum":["pending","signing","broadcast","paid","rejected","failed"],"title":"Status"},"txid":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Txid"},"created_at":{"type":"string","title":"Created At"},"updated_at":{"type":"string","title":"Updated At"}},"type":"object","required":["payout_id","merchant_payout_id","to_address","amount","fee","total","status","txid","created_at","updated_at"],"title":"PayoutView"}},"securitySchemes":{"HTTPBearer":{"type":"http","description":"t-gate 商戶金鑰","scheme":"bearer"}}}}