查詢訂單 / 查詢信用卡單筆明細紀錄

應用場景

提供特店查詢信用卡明細記錄。

❗ 注意事項:

  • 取得付款結果通知時,可呼叫此API驗證付款結果
  • 在訂單產生後的10分鐘內未收到綠界通知的付款結果,您可以使用API查詢付款結果。如遇銀行尚未回覆的情況,查詢結果中的RtnMsg為error_nopay,請於再過10分鐘後重新查詢。
  • 若有多筆訂單查詢的需求,請參考下載特店對帳媒體檔。

API介接網址

  • 測試環境: https://ecpayment-stage.ecpay.com.tw/1.0.0/CreditDetail/QueryTrade
  • 正式環境: https://ecpayment.ecpay.com.tw/1.0.0/CreditDetail/QueryTrade

HTTPS 傳輸協定

  • Content Type:application/json
  • HTTP Method:POST

特店Request參數說明 (Json格式)

MerchantID String(10)
特店編號 必填

RqHeader Object
傳輸資料 必填

Timestamp Number
傳輸時間 必填

請將傳輸時間轉換為時間戳(GMT+8),綠界會利用此參數將當下的時間轉為 Unix TimeStamp 來驗證此次介接的時間區間。

❗ 注意事項
  • 驗證時間區間為 10 分鐘內有效,若超過此驗證時間則此次訂單將無法建立,產生時間戳請參考相關資料
  • 合作特店須進行主機「時間校正」,避免主機產生時差,導致API無法正常運作。

Data String
加密資料 必填

此參數為加密過的 JSON 格式資料,加密方式請參考說明

特店Request參數範例 (Json格式)

				
					{
    "MerchantID": "3002607",
    "RqHeader": {
        "Timestamp": 1234567890
    },
    "Data": "enter your data"
}
				
			

Data參數說明(Json格式)

❗ 注意事項:請在加密前對參數值進行 URLEncode

MerchantID String(10)
特店編號 必填

MerchantTradeNo String(20)
特店交易編號 必填

TradeNo String(20)
綠界交易編號 

此欄位可從定期定額訂單查詢API取得。可查詢定期定額第一筆之後的授權資料內容。

Data參數範例(Json格式)

				
					{
    "MerchantID": "3002607",
    "MerchantTradeNo": "123486456"
} 

				
			

綠界Response參數說明 (Json格式)

MerchantID String(10)
特店編號 

RpHeader Object
回傳資料 

Timestamp Number
回傳時間 

時間戳 Unix timestamp

TransCode Int
回傳代碼 

1 代表 API 傳輸資料 (MerchantID, RqHeader, Data) 接收成功,實際的API執行結果狀態請參考 RtnCode 參數

TransMsg String(200)
回傳訊息 

Data String
加密資料 

此參數為加密過的 JSON 格式資料

綠界Response參數範例 (Json格式)

				
					{
    "MerchantID": "3002607",
    "RpHeader": {
        "Timestamp": 1234564848
    },
    "TransCode": 1,
    "TransMsg": "Success",
    "Data": "…"
}
				
			

Data參數說明(Json格式)

RtnMsg String
回應訊息

  • 若成功回傳空值其餘則為失敗
  • 若查無商家或商家己到期,回傳值為:error_Stop
  • 若查無該筆交易授權單號時,回傳值為:error_nopay
  • 若發生錯誤或資料檢核失敗,則回傳值為:error

RtnValue Object
回應資料

RtnMsg 為空值時才會回傳

TradeID Int
授權單號

Amount Int
交易金額

ClsAmt Int
已關帳金額

AuthTime String(24)
訂單成立時間

Status String(30)
交易狀態

若未有關帳明細交易,狀態回傳值如下:

  • Canceled:此筆交易已取消
  • Unauthorized:銀行未授權完成
  • Authorized:銀行已完成授權

若未有關帳明細交易,狀態回傳值如下

  • To be captured:要關帳
  • Captured:已關帳
  • Operation canceled:操作取消

CloseData Array[Object]
交易明細

Status String(30)
狀態

狀態回傳值如下:

  • To be captured:要關帳
  • Captured:已關帳
  • Canceled:已取消
  • Operation canceled:操作取消

Amount Int
交易金額

DateTime String(24)
關帳時間

Data參數範例(Json格式)

				
					{
    "RtnMsg": "",
    "RtnValue": {
        "TradeID ": 245678,
        "Amount ":100,
        "ClsAmt ": 100,
        "AuthTime": "2018/09/25 14:59:54",
        "Status": "To be captured"
    },
     "CloseData": [{
        "Status": "To be captured",
        "Amount":  100,
           "DateTime" :"2018/09/26 14:59:54"
    }]
}
				
			

YAML

提供的 YAML 文件用於定義 API 的配置、結構、操作和基礎設施管理等資訊,方便開發人員理解和使用 API。

				
					openapi: 3.1.0
info:
  title: ECPay Query Order API
  version: 1.0.0
servers:
  - url: https://ecpayment-stage.ecpay.com.tw
    description: Testing environment
  - url: https://ecpayment.ecpay.com.tw
    description: Production environment
paths:
  /Cashier/QueryTrade:
    post:
      summary: Query order information
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                MerchantID:
                  type: string
                  maxLength: 10
                  description: Merchant ID
                RqHeader:
                  type: object
                  properties:
                    Timestamp:
                      type: integer
                      description: Transmission timestamp
                Data:
                  type: string
                  description: Encrypted data
              required:
                - MerchantID
                - RqHeader
                - Data
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                type: object
                properties:
                  MerchantID:
                    type: string
                    maxLength: 10
                    description: Merchant ID
                  RpHeader:
                    type: object
                    properties:
                      Timestamp:
                        type: integer
                        description: Response timestamp
                  TransCode:
                    type: integer
                    description: Transmission code
                  TransMsg:
                    type: string
                    maxLength: 200
                    description: Transmission message
                  Data:
                    type: string
                    description: Encrypted data

components:
  schemas:
    Data:
      type: object
      properties:
        RtnCode:
          type: integer
          description: Transaction status code
        RtnMsg:
          type: string
          maxLength: 200
          description: Response message
        MerchantID:
          type: string
          maxLength: 10
          description: Merchant ID
        MerchantTradeNo:
          type: string
          maxLength: 20
          description: Merchant trade number
        TradeNo:
          type: string
          maxLength: 20
          description: ECPay trade number
        TradeAmt:
          type: integer
          description: Trade amount
        TradeDate:
          type: string
          maxLength: 20
          description: Trade date
        PaymentType:
          type: string
          maxLength: 20
          description: Payment type
        PaymentDate:
          type: string
          maxLength: 20
          description: Payment date
        ChargeFee:
          type: number
          description: Charge fee
        TradeStatus:
          type: string
          maxLength: 8
          description: Trade status
        CardInfo:
          type: object
          properties:
            AuthCode:
              type: string
              maxLength: 6
              description: Authorization code
            Gwsr:
              type: integer
              description: GWSR
            ProcessDate:
              type: string
              maxLength: 20
              description: Process date
            Amount:
              type: integer
              description: Amount
            Stage:
              type: integer
              description: Installment stage
            Stast:
              type: integer
              description: First installment amount
            Staed:
              type: integer
              description: Each installment amount
            Eci:
              type: integer
              description: 3D secure ECI value
            Card6No:
              type: string
              maxLength: 6
              description: First six digits of card number
            Card4No:
              type: string
              maxLength: 4
              description: Last four digits of card number
            RedDan:
              type: integer
              description: Redeem points used
            RedOkAmt:
              type: integer
              description: Actual redeem amount
            RedYet:
              type: integer
              description: Remaining redeem points
            PeriodType:
              type: string
              maxLength: 1
              description: Period type
            Frequency:
              type: integer
              description: Execution frequency
            ExecTimes:
              type: integer
              description: Execution times
            PeriodAmount:
              type: integer
              description: Period amount
            TotalSuccessTimes:
              type: integer
              description: Total successful executions
            TotalSuccessAmount:
              type: integer
              description: Total successful amount
            IssuingBank:
              type: string
              maxLength: 30
              description: Issuing bank name
            IssuingBankCode:
              type: string
              maxLength: 10
              description: Issuing bank code
            CustomField:
              type: string
              maxLength: 200
              description: Custom field

				
			

Copyright © Green World FinTech Service Co., Ltd. All rights reserved.

綠界官方網站