Get Checkout Page
To get/create checkout function.
ECPayPaymentManager.sharedInstance().createPayment()
Special note: When using Apple Pay, please use Apple Pay custom payment function. If you use createPayment() , your application may not be approved from the the Apple.
Input
Token String
Required
Each payment request requires a token, which is used to validate merchant’s identity.
- A token used to validate merchant’s identity
- The lifespan is 30 minutes.
Language String
Required
To use multilingual function.
- zh-TW: traditional Chinese
- en-US: English
UseResultPage Int
Required
Whether to display payment result. Whether to display the page of payment result or convenience/ATM payment number retrieval result.
- 0: No
- 1: Yes
AppStoreName String
Required
APP’s store name. Merchants can customize the APP store name.
callBack description
The callback function after createPayment is completed.
callbackStateStatus CallbackStateStatusType
Callback status
Special note: If the status is Cancel, you can query the order status using Searching Order API.
callbackStateMessage String
Callback status message.
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. Please save this parameter in merchant’s system in order to keep the relation between ECPay’s order ID merchants’ order ID MerchantTradeNo.
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
TradeStatus String(8)
Status of transaction
CardInfo Object
Credit card information. If using credit card or Union Pay, the CardInfo will be returned.
AuthCode String(6)
Authorization code. Not returned if using Union Pay card.
Gwsr Int
ID of authorization
ProcessDate String(20)
Date of processing authorization. Format: yyyy/MM/dd HH:mm:ss
Amount Int
Transaction/authorization amount
Stage Int
Number of installments
Stast Int
Amount of down payment
Staed Int
Amount of each period (except for down payment)
Eci Int
Return value of 3D (VBV). This is a value returned from the Directory Server (Visa, MasterCard, and JCB) to indicate the authentication results of cardholder’s credit card payment on 3D Secure.
Possible values:
5, 6, 2, 1: The value returned (ECI) means that transaction was a 3D secure authentication.
Card6No String(6)
First 6 digits of credit card
Card4No String(4)
Last 4 digits of credit card
RedDan Int
Credit card bonus used. The value will be returned if using the credit card bonus.
RedDeAmt Int
Amount deduced from bonus points. The value will be returned if using the credit card bonus.
RedOkAmt Int
Actual amount charged. The value will be returned if using the credit card bonus.
RedYet Int
Credit card bonus remained. The value will be returned if using the credit card bonus.
PeriodType String(1)
Type of subscription.
Frequency Int
Execution frequency. The value will be returned if using subscription plan. The value indicates the frequency of authorization (i.e. how often the authorization is executed.)
ExecTimes Int
Number of executions. The value will be returned if using subscription plan. The value indicated how many times the authorization is executed.
PeriodAmount Int
Amount to be authorized of each period. The value will be returned if using subscription plan.
TotalSuccessTimes Int
Number of total successful authorizations. The value will be returned if using subscription plan. The value indicates how many times the authorization is successfully executed.
TotalSuccessAmount Int
Total amount of all successful authorizations. The value will be returned if using subscription plan.
IssuingBank String(30)
Bank name
IssuingBankCode String(10)
Bank code
CVSInfo Object
CVS information. If using CVS as payment method, the CVSInfo will be returned.
PayFrom String(10)
Payment made at which convenience store. Possible values:
- family: FamilyMart
- hilife: Hi-Life
- okmart: OK mart
- ibon: 7-ELEVEN
PaymentNo String(14)
Payment number.
PaymentURL String(100)
Payment URL
BarcodeInfo Object
Barcode information. If using BARCODE as payment method, the BarcodeInfo will be returned.
PayFrom String(10)
Payment made at which convenience store.
- family: FamilyMart
- hilife: Hi-Life
- okmart: OK mart
- ibon: 7-ELEVEN
ATMInfo Object
ATM information. If using ATM as payment method, the ATMInfo will be returned.
ATMAccBank String(3)
Payer’s bank code
ATMAccNo String(5)
Last 5 digits of the payer’s bank account.
CustomField String(200)
A parameter for merchant to place customized value.
Example
ECPayPaymentManager.sharedInstance().createPayment(
token: token,
language: "zh-TW",
useResultPage: 1,
appStoreName: "測試商店"
) { (state) in
if let creditPayment:CreditPaymentCallbackState = state as? CreditPaymentCallbackState {
if let order = creditPayment.OrderInfo {
print(order)
}
if let card = creditPayment.CardInfo {
print(card)
}
if let aTM = creditPayment.ATMInfo {
print(aTM)
}
if let cVS = creditPayment.CVSInfo {
print(cVS)
}
if let barcode = creditPayment.BarcodeInfo {
print(barcode)
}
}
switch state.callbackStateStatus {
case .Success:
print("Success")
case .Fail:
print("Fail")
case .Cancel:
print("Cancel")
case .Unknown:
print("Unknown")
}
}