iOS APP SDK / Custom Apple Pay Button

Custom Apple Pay Button

The ECPay provides Apple Pay payment functionality and allows Merchants to create their own Apple Pay button styles and placements.

❗ Special note: Apple Pay button style must follow Apple interface guidelines. If you are not using a custom Apple Pay payment button, please refer to the get checkout page section.

The steps to customize your Apple Pay payment

  • Step 1. Before using ECPay’s Embedded Checkout Page, merchant’s server should call ECPay’s API to get a Token. After receiving the token, merchants should pass this token to merchant’s app to access the checkout page.
  • Step 2. Call createPayment() of SDK (inputting Token, Language, isUseApplePayButton, and callback) to get payment methods. The parameter isUseApplePayButton should be true.
				
					ECPayPaymentGatewayManager.sharedInstance().createPayment(token, language, useResultPage, appStoreName, isUseApplePayButton)
				
			

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.

isUseApplePayButton Bool
Required

Whether or not to define an Apple Pay payment button. Fix with true.

❗ Special note: Please set the isUseApplePayButton parameter to true. If you set it to anything else, you will not be able to define your own Apple Pay payment button.

  • Step 3. Define the Apple Pay button and place it in the desired location (view). Merchant must write its own program after button click.
				
					let applePayBtn = ApplePayButton.loadViewFromXib()
applePayBtn?.frame = self.applePayVIew.bounds
applePayBtn?.onClickApplePayButton = {//to do} 
				
			

Example

				
					ECPayPaymentGatewayManager.sharedInstance().createPayment(token: "your token", merchantID: "your merchantID", useResultPage: self.use_resultPage_Switch.isOn ? 1 : 0, appStoreName: "測試的店", language: self.use_enUS_Switch.isOn ? "en-US" : "zh-TW",isUseApplePayButton: true)
{ (state) in}
    //to do
}

let applePayBtn = ApplePayButton.loadViewFromXib()
applePayBtn?.frame = self.applePayVIew.bounds
applePayBtn?.onClickApplePayButton = {
    //to do
}
				
			

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

Green World