Scenario
Merchant’s request this API to search a single order of credit card payment.
API URLs
- Stage: https://ecpayment-stage.ecpay.com.tw/1.0.0/CreditDetail/QueryTrade
- Production: https://ecpayment.ecpay.com.tw/1.0.0/CreditDetail/QueryTrade
Message format
- Content Type:application/json
- HTTP Method:POST
Request (Json format)
MerchantID String(10)
Required
For platform merchants, the value please populate with the Platform merchant’s MerchantID.
RqHeader Object
Required
Request header
Timestamp Number
Required
Unix timestamp
Special note:
- ECPay will verify the timestamp.If ECPay receives the request is more 10 minutes late than the timestamp, the transaction will be failed.
- Merchants are suggested to synchronize the time of a computer on client- or server-side to another server or nearest reference time source.
- For more details can be seen here; another online tool can be found here.
Data String
Required
Payload of JSON that has been encrypted.
Request Example (Json format)
{
"MerchantID": "3002607",
"RqHeader": {
"Timestamp": 1234567890
},
"Data": "enter your data"
}
Message payload of Data (Json format)
Special note: Please urlencode the JSON string firstly and then do AES encryption.
PlatformID String(10)
Platform ID
- This is used by platform merchants and will be provided by ECPay.
- For platform merchants, please populate with [MerchantID].
- For general merchants, please set as null.
MerchantID String(10)
Required
Merchant ID
MerchantTradeNo String(20)
Required
Merchant’s order ID
TradeNo String(20)
ECPay’s order ID. This could be retrieved by calling (/Cashier/QueryTrade) API (except for the first time authorization.)
Data Example:(Json format)
{
"MerchantID": "3002607",
"PlatformID": "2000132",
"MerchantTradeNo": "123486456"
}
Response (Json format)
MerchantID String(10)
Merchant ID
RpHeader Object
Timestamp Number
Unix timestamp
TransCode Int
Response codes to indicate whether the payload is successfully accepted.
- 1: Payload (i.e. MerchantID, RqHeader, and Data) is successfully accepted by ECPay.
- Others: failed.
TransMsg String(200)
Response message to indicate whether the payload is successfully accepted.
Data String
Payload of JSON that has been encrypted.
Response Example (Json format)
{
"MerchantID": "3002607",
"RpHeader": {
"Timestamp": 1234564848
},
"TransCode": 1,
"TransMsg": "Success",
"Data": "…"
}
Message payload of Data (Json format)
RtnMsg String
Response codes to indicate whether the API is successfully executed or not.
- Null value: success,
- others: failed.
- error_Stop: no merchant or the merchant does not exist
- error_nopay: AuthCode not found
- error: data error or data verification failed
- error_Length: data length incorrect
- error_Amount: amount incorrect
- error_close: the payment is capturing now and cannot be captured by API.
RtnValue Object
Response messages. If RtnMsg=null, RtnValue will be returned.
TradeID Int
Authorization ID
Amount Int
Transaction amount
ClsAmt Int
Amount captured
AuthTime String(24)
Authorization time
Status String(30)
If there are no details, the status will be:
- Canceled: This order has been canceled.
- Unauthorized:This order is not authorized by bank.
- Authorized:This order is authorized.
If there are details, the status will be:
- To be captured
- Captured
- Operation canceled
CloseData Array[Object]
Order details
Status String(30)
Possible values:
- To be captured
- Captured
- Canceled
- Operation canceled
Amount Int
Transaction amount
DateTime String(24)
Time of capture
Data Example(Json format)
{
"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"
}]
}