代碼意義 API Response Code
📋 重要說明:欄位大小寫差異
| API 類型 | result 欄位 | message 欄位 | result_object 欄位 | Result Code 類型 |
|---|---|---|---|---|
| Platform APIs | result (小寫) | message (小寫) | result_object (小寫) | 字串 (“000”, “999”) |
Platform APIs
重要: 所有 Platform APIs 使用以下 Response 格式:(小寫欄位: result, message, result_object)
{
"result": "string",
"message": "string or null",
"result_object": object or null
}
1.1 POST /platform/authpay/limited
功能:授權綁定 (Authorization Binding)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | {auth_no, authpay_url, qr_img, qr_timeout} | 成功建立授權綁定連結 |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
成功 result_object 結構:
{
"auth_no": "650660555924205568",
"authpay_url": "https://test.jkopay.com/web/authpay/url?j=...",
"qr_img": "https://test.jkopay.com/web/authpay/qr?j=...",
"qr_timeout": 1635297229729
}
1.2 POST /platform/authpay/transaction
功能:授權扣款請求 (Merchant Platform Authorization Request)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | Transaction 物件 | 扣款成功 |
"100" | "Order does not exist" | null | 訂單不存在 |
"101" | "Order has been paid" | null | 訂單已付款 |
"104" | "Payment/transfer amount is over the monthly limit" | null | 付款/轉帳金額超過月限額 |
"110" | "Store not found" | null | 查無此商店 |
"115" | "Payment failed" | null | 付款失敗 |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"301" | "Invalid auth_no" | null | 無效的授權編號 |
"302" | "Canceled auth_no" | null | 授權編號已取消 |
"303" | "FinalPrice exceeded the max amount quota set by the user" | null | 最終金額超過用戶設定的最高額度 |
"304" | "Order finalPrice is not consistent with authpay billing amount" | null | 訂單最終金額與授權扣款帳單金額不一致 |
"305" | "Authpay payment exceeds current billing cycle times" | null | 授權扣款超過當前計費週期次數 |
"306" | "Authpay payment transaction time invalid.(Available at 08:00 - 20:00 UTC+8)" | null | 授權扣款交易時間無效(僅限 08:00 – 20:00 UTC+8) |
"307" | "Payment with the same auth_no is allowed one at a time" | null | 同一授權編號同時僅允許一筆付款 |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
成功 result_object 結構:
{
"platform_order_id": "test-roy-010",
"status": 0,
"tradeNo": "J000384112110270000E",
"trans_time": "2021-10-27 09:04:51",
"currency": "TWD",
"final_price": "50",
"redeem_amount": "0",
"redeem_detail": {
"jko_coin_amount": 0,
"official_coupon_amount": 0,
"store_coupon_amount": 0
},
"debit_amount": "50",
"refund_history": [],
"invoice_vehicle": "/9-99+99",
"maskNo": null,
"channel_type": "account"
}
失敗 Response 範例:
{
"result": "121",
"message": "Insufficient bank account balance.",
"result_object": null
}
1.3 POST /platform/authpay/refund
功能:訂單退款 (Order Refund)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | 退款資訊物件 | 成功建立退款 |
"100" | "Order does not exist" | null | 訂單不存在 |
"103" | "Error in refund amount" | null | 退款金額錯誤 |
"105" | "Inconsistent refund amount" | null | 退款金額不一致 |
"113" | "Refund reject due to refund amount exceeds total unreimbursed amount." | null | 退款金額超過可退款總額 |
"116" | "JKOPAY coupon reimbursement failed, please contact JKOPAY for assistance in refund" | null | 退款失敗 (Coupon),請聯繫街口協助退款 |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
成功 result_object 結構:
{
"refund_tradeNo": "K0026910118070413C4001",
"debit_amount": 70,
"redeem_amount": 30,
"redeem_detail": {
"jko_coin_amount": 20,
"official_coupon_amount": 0,
"store_coupon_amount": 10
},
"refund_time": "2018-07-01 12:20:20"
}
1.4 GET /platform/authpay/inquiry
功能:訂單查詢 (Inquiry)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | {transactions: [...]} | 成功查詢 (含所有訂單狀態) |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
transactions 陣列中每筆訂單的 status:
0– 交易成功 (transaction success)100– 付款失敗 (payment fail)101– 訂單尚未付款 (order has not been paid)102– 訂單編號不存在 (order number does not exist)
result_object 結構:
{
"transactions": [
{
"platform_order_id": "87",
"status": 0,
"tradeNo": "J0026910118070413C4",
"trans_time": "2018-07-01 12:00:00",
"currency": "TWD",
"final_price": 1000,
"redeem_amount": 300,
"debit_amount": 700,
"redeem_detail": {
"jko_coin_amount": 200,
"official_coupon_amount": 0,
"store_coupon_amount": 100
},
"refund_history": [
{
"platform_order_id": "87",
"refund_order_id": "87001",
"refund_tradeNo": "K0026910118070413C4001",
"time": "2018-07-01 12:20:20",
"amount": 100,
"debit_amount": 70,
"redeem_amount": 30,
"redeem_detail": {
"jko_coin_amount": 20,
"official_coupon_amount": 0,
"store_coupon_amount": 10
}
}
]
},
{
"platform_order_id": "88",
"status": 101
}
]
}
1.5 GET /platform/authpay/detail
功能:查詢授權狀態 (Inquiry on Authorization Status)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | {authpay: GrantedAuthPay} | 成功查詢授權狀態 |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"301" | "Invalid auth_no" | null | 無效的授權編號 |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
result_object 結構:
{
"authpay": {
"type": "limited",
"auth_no": "599669611989962752",
"status": "cancel",
"platform_authpay_id": "AUTHPAY_001"
}
}
1.6 POST /platform/authpay/cancel
功能:取消授權綁定 (Cancellation on Authorization)
所有可能的 Response:
| result | message | result_object | 觸發條件 |
|---|---|---|---|
"000" | null | null | 成功取消授權綁定 |
"200" | "Bad request" | null | BadParams (參數錯誤) |
"201" | "Validation error" | null | 驗證錯誤 |
"301" | "Invalid auth_no" | null | 無效的授權編號 |
"302" | "Canceled auth_no" | null | 授權編號已取消(重複取消) |
"999" | "Internal Error" | null | 街口方系統出現非預期錯誤 |
成功 Response 範例:
{
"result": "000",
"message": null,
"result_object": null
}