Scenario
Provide merchants with the capability to perform backend transaction authorization using the BindCardID obtained from the bound credit card.
Special notes: As some of the APIs need to be connected to the bank, the response time may increase if the bank disconnects. If you must set an API timeout, we recommend 30 seconds minimum.
API URLs
- Stage: https://ecpg-stage.ecpay.com.tw/Merchant/CreatePaymentWithCardID
- Production: https://ecpg.ecpay.com.tw/Merchant/CreatePaymentWithCardID
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)
MerchantID String(10)
Required
BindCardID String(64)
Required
Bound Credit Card Code
OrderInfo Object
Required
MerchantTradeDate String(20)
Required
Format : yyyy/MM/dd HH:mm:ss
MerchantTradeNo String(20)
Required
Merchant’s order ID
- Created by the merchant, [MerchantTradeNo] should be a unique identifier combined with upper and lower case alphanumeric characters.
Special note: How can merchants avoid duplicated MerchantTradeNo? Please read the FAQ.
TotalAmount Int
Required
Amount of order
- Integer only; decimal is not accepted.
- New Taiwan Dollar only. The limit amount of each payment please refet to: https://www.ecpay.com.tw/Business/payment_fees
ReturnURL String(200)
Required
The URL of merchant’s server to receive ECPay’s payment notification (callback).
- When consumer completes payment, ECPay’s server will respond payment notification (callback) to ReturnURL (using POST). For more detail a please see Payment result notification (callback).
Special note:
- This is a server-side URL. Please do not set this URL same as OrderResultURL, which is a URL of client-side.
- Upon receiving the callback from ECPay, please respond a string “1|OK“.
- The string “1|OK” is merely a response, which is to tell ECPay’s server that this callback is successfully received. The 1|OK will not change the payment status.
TradeDesc String(200)
Required
Description of order
ItemName String(400)
Required
Name of products
- Each product should be separated by a hash (#).
ConsumerInfo Object
Consumer information
MerchantMemberID String(60)
Consumer’s ID (if merchant has a member system).
- Required if RememberCard: 1 (using the saving card function)
Email String(30)
Credit card holder’s email
Phone String(60)
Credit card holder’s phone number.
Special notes: Mobile country code is accepted, but the prefix should not have plus symbol (+). E.g.: 886912345678
Name String(50)
Credit card holder’s name. Chinese, English and some special chacters are accepted. Special characters support: , . ( ) / –
CountryCode String(3)
Country code
- A 3-digit contry code of the credit card holder’s bill address, which should follow ISO 3166.
Address String(50)
Credit card holder’s bill address.
CreditInstallment String(20)
Periods (cycles) of credit card installment plan.
- Required if ChoosePaymentList: 0 (all payment methods) or 2 (credit card installments).
- This parameter supports more than one period, and each value should be separated by comma (,). For example, CreditInstallment: 3,6,12,18,24
CustomField String(200)
A parameter for merchant to place customized value.
Data Example:(Json format)
{
"MerchantID": "3002607",
"BindCardID": "abc123456ac",
"OrderInfo": {
"MerchantTradeDate" : "2022/05/23 14:10:00",
"MerchantTradeNo" : "1234567890",
"TotalAmount": 500,
"TradeDesc" : "交易描述",
"ItemName" : "泡麵#清潔用品",
"ReturnURL" : "https://aa.aa.aa"
},
"ConsumerInfo": {
"MerchantMemberID": "test123456"
}
}
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)
RtnCode Int
Response codes to indicate whether the API is successfully executed or not.
- 1: API is successfully executed.
- Others: failed.
- For more details please see error codes.
RtnMsg String(200)
Response messages.
PlatformID String(10)
Platform ID
MerchantID String(10)
OrderInfo Object
Order information
MerchantTradeNo String(20)
Merchant’s order ID
TradeNo String(20)
ECPay’s order ID
TradeAmt Int
Transaction amount
TradeDate String(20)
Time at which the order was created. Format: yyyy/MM/dd HH:mm:ss
PaymentType String(20)
Payment method
PaymentDate String(20)
Date of payment. Format: yyyy/MM/dd HH:mm:ss
ChargeFee Number
ECPay’s service charge
ProcessFee Number
ECPay’s transaction processing fee
TradeStatus String(8)
Status of transaction
CardInfo Object
Credit card information
AuthCode String(6)
Authorization code
Gwsr Int
ID of authorization
ProcessDate String(20)
Date of processing authorization. Format: yyyy/MM/dd HH:mm:ss
Amount Int
Transaction/authorization amount
Card6No String(6)
First 6 digits of credit card
Card4No String(4)
Last 4 digits of credit card
IssuingBank String(30)
Bank name
IssuingBankCode String(10)
Bank code
Stage Int
Number of installments
Stast Int
Amount of down payment
Staed Int
Amount of each period (except for down payment)
CoBrandingInfo Array[Object]
CoBrandingCode String(20)
Comment String(100)
CustomField String(200)
A parameter for merchant to place customized value.
Data Example(Json format):
{
"RtnCode": 1,
"RtnMsg": "Success",
"PlatformID": "1234567890",
"MerchantID": "1234567890",
"CardInfo":
{
"Card6No": "123456",
"Card4No": "1234",
"IssuingBank": "中國信託商業銀行",
"IssuingBankCode ": "822",
"AuthCode": "654123",
"Gwsr": 125,
"ProcessDate": "2022/09/18 15:39:10",
"Amount": 2
"Eci": 1,
},
"OrderInfo":
{
"MerchantTradeNo": "test123466",
"TradeNo": "123456789",
"PaymentDate": "2022/09/18 15:39:10",
"TradeAmt": 2,
"PaymentType": "Credit",
"TradeDate": "2022/09/18 15:39:10",
"ChargeFee": 0,
"TradeStatus": "1",
}
}