Android APP SDK / Get Checkout Page

Get Checkout Page

To get/create checkout function.

				
					PaymentkitManager.createPayment(mActivity, mFragment, mModel.token.get(), languageCode, useResultPage, mExampleData.getAppStoreName(), PaymentkitManager.RequestCode_CreatePayment);
				
			

Input

Activity Android Activity
Required

Activity application component. Please provide Activity component of current page.

Fragment Android Fragment

Fragment component. If switching to Fragment, this parameter is required.
If not, Fragment will not be able to receive payment result.

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, and Two languages are avaliable:

  • 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.

RequestCode Int
Required

Return value of the UI. When closing the credit card payment page, a value of Activity/Fragment will be returned.

CreatePaymentResult

Need to be used with CreatePayment.

				
					PaymentkitManage.createPaymentResult(mActivity, resultCode, data, CallbackFunction());
				
			

Input

Activity Android Activity
Required

Activity application component. Please provide Activity component of current page.

ResultCode Int
Required

Activity result code.

Data Intent
Required

Android Intent

Callback CallbackFunction
Required

To execute the asynchronous callbacks.

callBack description

The callback function after createPayment is completed.

CallbackStatus CallbackStatus

❗ Special note: If the status is Cancel, you can query the order status using Searching Order API.

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.

PaymentType PaymentType

enum PaymentType

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

Get checkout page 

				
					PaymentkitManager.createPayment(mActivity, mFragment,
        mModel.token.get(), languageCode, useResultPage, mExampleData.getAppStoreName(), PaymentkitManager.RequestCode_CreatePayment);
				
			

onActivityResult

				
					public void onActivityResult(int requestCode, int resultCode, Intent data) {
    Utility.log("onActivityResult(), requestCode:" + requestCode + ", resultCode:" + resultCode);
    if(requestCode == PaymentkitManager.RequestCode_CreatePayment) {
        PaymentkitManager.createPaymentResult(mActivity, resultCode, data, new CallbackFunction<CreatePaymentCallbackData>() {
            @Override
            public void callback(CreatePaymentCallbackData callbackData) {
                switch (callbackData.getCallbackStatus()) {
                    case Success:
                        if(callbackData.getRtnCode() == 1) {
                            //to do..
                        } else {
                           //else to do..
                        }
                        break;
                    case Fail:
                        //Fail to do
                        break;
                    case Cancel:
                        //Cancel to do
                        break;
                    case Exit:
                        //Exit to do
                        break;
                }
            }
        });
    }
}
				
			

Copyright © Green World FinTech Service Co., Ltd. All rights reserved.

Green World