Scenario
Enables merchants to check a single credit card transaction.
API URLS
- Stage: This API can not be used because no real authorizations can be provided.
- Production :https://payment.ecPay.com.tw/CreditDetail/QueryTrade/V2
HTTPS Transfer Protocol
- Content Type :application/x-www-form-urlencoded
- HTTP Method :POST
Request Parameters Description
MerchantID String(10)
Required
CreditRefundId Int
Required
Credit card authorization number.
- When creating order, send [NeedExtraPaidInfo] = Y. Once the consumer makes the payment, ECPay will respond the payment notification to merchant’s ReturnURL, this value = gwsr.
CreditAmount Int
Required
CreditCheckCode Int
Required
Merchant Checksum.
- Or this value can also be found in Merchant’s admin -> Credit Card Acquiring-> Credit Card Authorization Information.
CheckMacValue String
Required
Checksum.
- Please refer to the Appendix Checksum Mechanism.
Return Parameter Details
RtnMsg String(200)
- If it is successful, the return value will be empty string.
- If there is no merchant or the merchant has expired, the return value is: error_Stop.
- If there is no such transaction authorization number, the return value is: error_nopay.
- If an error occurs or the data check fails, the return value is: error.
RtnValue json
JSON chart format.
If the empty string indicates a failed trade.
TradeID Int
Authorization number.
amount Int
Transaction amount
clsamt Int
Amount settled.
authtime String(24)
Transaction time.
status String(30)
If there are no settlement transaction details, the status return value will be:
- Canceled: This transaction has been canceled
- Unauthorized: Unauthorized by bank
- Authorized: Bank has completed authorization
If there are a settlement transaction details, the status return value will be:
- Refused by bank
- To be settled
- Settling
- Has been settled
- To be canceled
- Cancellation in process
- Canceled
- Bank chargeback in progress
- Bank chargeback complete
- Batch failed
- unknown
- Operation canceled
close_data json
close_data Parameter Details
status String(30)
The status return value is as follows:
- Refused by bank
- To be settled
- Settling
- Has been settled
- To be canceled
- Cancellation in processBank chargeback in progress
- Bank chargeback complete
- Batch failed
- unknown
- Operation canceled
amount Int
Transaction amount.
sno String(30)
Settlement serial number.
datetime String(24)
Settlement time.
Return Parameter Sample
{
"RtnMsg":"",
"RtnValue":{
"TradeID":"0015625112",
"amount":"1",
"clsamt":"1",
"authtime":"2016/5/12 下午 07:09:17",
"status":"已關帳",
"close_data":[
{
"status":"已關帳",
"sno":"2782343",
"amount":"1",
"datetime":"2016/5/12 下午 08:00:00"
}
]
}
YAML
The provided YAML file is used to define information such as the configuration, structure, operations, and infrastructure management of the API, making it easier for developers to understand and use the API.
openapi: 3.1.0
info:
title: ECPay Credit Card Transaction Detail Query API
version: 1.0.0
servers:
- url: https://payment.ecpay.com.tw
description: Production Environment
paths:
/CreditDetail/QueryTrade/V2:
post:
summary: Query credit card transaction details
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
MerchantID:
type: string
description: Merchant ID provided by ECPay
CreditRefundId:
type: integer
description: Credit card authorization number
CreditAmount:
type: integer
description: Transaction amount
CreditCheckCode:
type: integer
description: Merchant check code
CheckMacValue:
type: string
description: CheckMac value for verification
required:
- MerchantID
- CreditRefundId
- CreditAmount
- CreditCheckCode
- CheckMacValue
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
RtnMsg:
type: string
description: Response message
RtnValue:
type: object
properties:
TradeID:
type: integer
description: Authorization number
amount:
type: integer
description: Transaction amount
clsamt:
type: integer
description: Amount closed
authtime:
type: string
description: Order creation time
status:
type: string
description: Transaction status
close_data:
type: array
items:
type: object
properties:
status:
type: string
description: Status of the close transaction
sno:
type: string
description: Close transaction serial number
amount:
type: integer
description: Close transaction amount
datetime:
type: string
description: Close transaction time