授權扣款 Authorization deduction request
授權扣款 transaction API
Method:POST
Domain:https://[Host]/platform/authpay/transaction
說明:
電商平台呼叫此API,發動該筆平台授權序號的授權扣款。
請求參數 (Request Parameter)
參數名稱 Parameter | 資料型態 Data Type | 最大長度 Maximum | 必要的 Required | 說明 | Description |
---|---|---|---|---|---|
auth_no | string | 30 | Y | 街口端授權編號 | Jkopay authorization number. |
order fields | |||||
order.platform_order_id | string | 60 | Y | 電商平台端交易序號 需為唯一值,不可重複。 | The ID of the order is saved on the platform. This ID needs to be unique and unrepeated. |
order.trade_name | string | 30 | Y | 交易名稱 (會顯示於app中授權交易記錄頁) | Transaction name (shown in the authorization record page in the JKOPay app). |
order.currency | string | 3 | Y | 付款貨幣[ISO 4217],請帶入 “TWD” | Platform’s order currency [ISO 4217]. Please use “TWD”. |
order.total_price | decimal | 20,0 | Y | 訂單價格(原始幣別) | Total price (original currency). |
order.final_price | decimal | 20,0 | Y | 訂單應付價格(原始幣別) | Final price would be paid (original currency). |
order.unredeem | decimal | 20,0 | N | 訂單不可折抵回饋金額(原始幣別)預設為0 | The amount that cannot be discounted or not qualified for reward (original currency) Default is 0. |
order.remark | string | 500 | N | 備註 | Memo. |
order.products fields | |||||
order.products.name | string | 60 | N | 商品名稱(charset=utf-8) | |
order.products.img | string | 500 | N | 商品網址 | |
order.products.unit_count | int | N | 商品數量 | ||
order.products.unit_price | decimal | 20,0 | N | 商品單價(原價) | |
order.products.unit_final_price | decimal | 20,0 | N | 商品單價(付款價格) | |
order.products.category_path | string[] | N |
範例 (Example):
授權扣款 API Request:
POST https://{街口路徑}/platform/authpay/transaction
Content-Type: application/json
api-key: 0038ff51693e2f44cbf8d2075835029b3c9bb0a863373b947e4c1f6c8742a095
digest: 795ca21ca75064da4d361bbc5120171e46251785891540dbf2f3af94699ae428
{
"auth_no": "605495635344494592",
"order": {
"platform_order_id": "authpay_order_id_001",
"trade_name": "第n次扣款",
"currency": "TWD",
"total_price": 50,
"final_price": 50,
"unredeem": 0,
"remark": "備註",
"products": [
{
"name": "商品1",
"img": null,
"unit_count": 1,
"unit_price": 50,
"unit_final_price": 50,
"category_path": []
}
]
}
}
返回參數 (Response JSON Body)
參數名稱 Parameter | 資料型態 Data Type | 說明 | Description |
---|---|---|---|
result | string | 請參照 API 回覆代碼(ResponseCode) | Please refer to API response code (ResponseCode). |
message | string | 結果訊息或失敗理由 | Result message or reason of error. |
result_object fields | 回覆物件 | ||
result_object.platform_order_id | string | 電商平台端交易序號 | The ID of the order is saved on the platform. |
result_object.status | int | (Status非0時,以下欄位不回覆) | (When the status does not equal 0, the following parameters will not be returned). |
result_object.tradeNo | string | 街口端交易序號 | JKOPay transaction number. |
result_object.trans_time | string | 交易時間 格式 : yyyy-MM-dd HH:mm:ss | Transaction time. format: yyyy-MM-dd HH:mm:ss |
result_object.currency | string | 原始幣別 [ISO 4217](TWD) | Currency [ISO 4217](TWD). |
result_object.final_price | decimal | 訂單應付價格(原始幣別) | The final price would be paid (original currency). |
result_object.redeem_amount | decimal | 折抵金額=街口幣折抵+官方街口券折抵+店家街口券折抵 | Discounted amount = amount of JKO coin + JKO official coupon + store coupon |
result_object.debit_amount | decimal | 付款方式扣款金額(折抵後金額) | Amount paid (after discount). |
result_object.invoice_vehicle | string | 街口帳戶發票載具 | Jkopay account invoice carrier. |
result_object.maskNo | string | 付款工具使用信用卡時提供卡號前六後四碼 格式:222222******3333 | When channel_type is “credit card” then the JKOPay server will reply with the card number(The first six numbers and last four numbers). Format: 222222******3333 |
result_object.channel_type | string | 支付工具 account: 儲值帳戶 bank: 銀行帳戶 creditcard: 信用卡 | User’s payment method account: JKOPay balance bank: bank account creditcard: credit card (not available for crossborder payment). |
result_object.redeem_detail fields | |||
result_object.redeem_detail.jko_coin_amount | decimal | 街口幣折抵金額 | JKO coin redeem amount. |
result_object.redeem_detail.official_coupon_amount | decimal | 官方街口券折抵金額 | official coupon redeem amount. |
result_object.redeem_detail.store_coupon_amount | decimal | 店家街口券折抵金額 | store coupon redeem amount. |
範例 (Example):
授權扣款 transaction API Response (成功):
{
"result": "000",
"message": null,
"result_object": {
"platform_order_id": "authpay_order_id_001",
"status": 0,
"tradeNo": "J0153402025021300123",
"trans_time": "2025-02-13 16:03:01",
"currency": "TWD",
"final_price": 50,
"redeem_amount": 0,
"debit_amount": 50,
"invoice_vehicle": "/JURT123",
"maskNo": null,
"channel_type": "creditcard",
"redeem_detail": {
"jko_coin_amount": 0,
"official_coupon_amount": 0,
"store_coupon_amount": 0
}
}
}
授權扣款 transaction API Response (失敗):
{
"result": "121",
"message": "Insufficient bank account balance.",
"result_object": null
}