Scenario:
The merchant can search for authorization details of every transaction under order inquiry for periodic fixed-amount purchases.
- Step 1. Merchant: Transmit the following parameters to API URLS via Server Site POST.
- Step 2. ECPay : Return periodic fixed-amount order information once received and verified to be correct.
API URLS:
- Stage:https://payment-stage.ecpay.com.tw/Cashier/QueryCreditCardPeriodInfo
- Production:https://payment.ecpay.com.tw/Cashier/QueryCreditCardPeriodInfo
HTTPS Transfer Protocol
- Content Type :application/x-www-form-urlencoded
- HTTP Method :POST
Request Parameters Description
MerchantID String(10)
Required
MerchantTradeNo String(20)
Required
Merchant Transaction ID transmitted to ECPay when order was created.
TimeStamp Int
Required
- Convert current time to UnixTimeStamp (see example) to verify the time interval of this interfacing.
- ECPay verification time interval is currently set to be under 3 minutes and interfacing will expire if time is exceeded.
- Reference: http://www.epochconverter.com/。
CheckMacValue String
Required
Please refer to the Appendix Checksum Mechanism
Used by contracted platform merchants.
- For general merchants or platform merchant interfacing, please leave empty.
- For use by platform merchants, please set [MerchantID] as the parameter.
Response Parameter Details:
Merchant Transaction ID transmitted to ECPay when order was created.
The ECPay transaction ID generated in the first authorization.
A return value of 1 indicates successful authorization, while any other value indicates failure. For more information on error codes, please refer to the list of transaction status codes.
Time of successful authorization.
The format is yyyy/MM/dd HH:mm:ss.
Authorization code.
Last 4 digits of credit card
First 6 digits of credit card
The return value is as follows:
- If it is 0, the authorization has been canceled
- If it is 1, the authorization is being processed
- If it is 2, the authorization has been completed
Individual authorization records.
- For example, if authorization has been successful for 3 times already (TotalSuccessTimes is 3), you will see 3 authorization records.
- For field details, see the authorization detail parameters for periodic fixed-amount purchases below.
A return value of 1 indicates successful authorization, while any other value indicates failure. For more information on error codes, please refer to the list of transaction status codes.
The format is yyyy/MM/dd HH:mm:ss.
ECPay transaction ID.
Please save the link between the ECPay transaction ID and the merchant transaction ID [MerchantTradeNo].
Return examples
{
"MerchantID":"1050123",
"MerchantTradeNo":"ecpay1234",
"TradeNo":"20140721173014442498",
"RtnCode":1,
"PeriodType":"D",
"Frequency":1,
"ExecTimes":12,
"PeriodAmount":1000,
"amount":1000,
"gwsr":24548751,
"process_date":"2014/07/21 17:35:45",
"auth_code":"237523",
"card4no":"2369",
"card6no":"523782",
"TotalSuccessTimes":3,
"TotalSuccessAmount":3000,
"ExecStatus":"1",
"ExecLog":
[
{"RtnCode":1,"amount":1000,"gwsr":24548751,"process_date":"2014/07/21 17:35:45","auth_code":"237523","TradeNo":"20140721173014442498"},
{"RtnCode":1,"amount":1000,"gwsr":24549277,"process_date":"2014/07/22 01:12:30","auth_code":"185279","TradeNo":"20140722011230346534"},
{"RtnCode":1,"amount":1000,"gwsr":24552639,"process_date":"2014/07/23 01:12:25","auth_code":"693851","TradeNo":"20140723011225646424"}
]
}
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 Periodic Order Query API
version: 1.0.0
servers:
- url: https://payment.ecpay.com.tw
description: Production Environment
- url: https://payment-stage.ecpay.com.tw
description: Testing Environment
paths:
/Cashier/QueryCreditCardPeriodInfo:
post:
summary: Query periodic order information
requestBody:
content:
application/x-www-form-urlencoded:
schema:
type: object
properties:
MerchantID:
type: string
description: Merchant ID provided by ECPay
MerchantTradeNo:
type: string
description: Merchant trade number
TimeStamp:
type: integer
description: Unix timestamp of the request
CheckMacValue:
type: string
description: CheckMac value for verification
PlatformID:
type: string
description: Partner platform ID
required:
- MerchantID
- MerchantTradeNo
- TimeStamp
- CheckMacValue
responses:
'200':
description: Successful response
content:
application/json:
schema:
type: object
properties:
MerchantID:
type: string
description: Merchant ID
MerchantTradeNo:
type: string
description: Merchant trade number
TradeNo:
type: string
description: ECPay trade number
RtnCode:
type: integer
description: Transaction status code (1 for success, others for failure)
PeriodType:
type: string
description: Period type of the order
Frequency:
type: integer
description: Execution frequency of the order
ExecTimes:
type: integer
description: Number of executions of the order
PeriodAmount:
type: integer
description: Amount for each execution
amount:
type: integer
description: Amount for the first authorization
gwsr:
type: integer
description: Transaction serial number for the first authorization
process_date:
type: string
description: Process date of the first authorization (yyyy/MM/dd HH:mm:ss)
auth_code:
type: string
description: Authorization code of the first transaction
card4no:
type: string
description: Last 4 digits of the card number
card6no:
type: string
description: First 6 digits of the card number
TotalSuccessTimes:
type: integer
description: Total number of successful authorizations
TotalSuccessAmount:
type: integer
description: Total amount of successful authorizations
ExecStatus:
type: string
description: Execution status (0: terminated, 1: in progress, 2: completed)
ExecLog:
type: array
items:
type: object
properties:
RtnCode:
type: integer
description: Transaction status code
amount:
type: integer
description: Authorized amount
gwsr:
type: integer
description: Transaction serial number
process_date:
type: string
description: Process date (yyyy/MM/dd HH:mm:ss)
auth_code:
type: string
description: Authorization code
TradeNo:
type: string
description: ECPay trade number