There are three main callbacks that must be implemented (the rest are optional):
onGetTransactionInfo - calculates the total amount based on the charge amount, fees, taxes, shipping costs, etc.
onValidateMerchant - a callback to be called to validate the Apple Pay Merchant.
onPaymentAuthorize - a callback that will be called after the consumer pays and Apple returns a token with all of the requested consumer information, like the billing address, shipping address, etc. This is where you need to make an ajax call to your server with the Apple Payload. The sample for making an ajax call is below.
window.ckApplePay object - controls initialization of Apple Pay button
Method
Call Required
Description
enableApplePay
Yes
updateAmount
Conditional
Updates amount on Apple Sheet.
You can provide either All, One, or None of the parameters for enableApplePay call.
initFunction Required - either function name or function itself to initialize Apple Pay.
amountField Optional - if specified, the Apple Pay total amount will be automatically updated whenever the amount has changed.
amountField is not specified - in this case, itβs up to you to provide the correct amount for Apple Pay. One of the ways to do it is to call window.ckApplePay.updateAmount manually.
EnableApplePayParams Object
Name
Type
Required
Description
initFunction
String|Object
Yes
Either function name or function itself to initialize Apple Pay
amountField
String|Object
No
Field containing amount.
Could be either the name of the field (String) or
the field itself (Object)
For more details, please contact your Cardknox Representative.
Questions?
Find the latest version of iFields at:
For a full sample code please refer to
For the list of available callbacks, please refer to .
For full sample code, please refer to
initAP function above returns .
Initializes and enables Apple Pay Button.
Takes object.
Step 1: Create an endpoint and method for API Integration on your server side that takes an object containing total transaction amount and and makes a call to Cardknox.
Sample Object:
This section assumes that you already know how to integrate other payments with
Once the consumer confirms the payment, Apple Pay API generates an in the form of a JSON string.