Apple Pay allows customers to make secure payments using their supported iOS and macOS devices. Apple Pay is available in South Africa, a full list of supported countries and supported devices can be found on the Apple website. 


There is no additional fee for adding Apple Pay to your profile. The normal card processing fee also applies to your Apple Pay transactions.


This guide provides step-by-step instructions for enabling Apple Pay using CopyandPay, the Mobile SDK, Apple Pay on the Web, Checkout and our available commerce plugins to accept Apple Pay in-app and during web checkout on Safari. After completing the following steps, your payment forms will include an Apple Pay button that allows customers to use Apple Pay to make online purchases on their supported devices.



Integrating with Apple Pay



Adding Apple Pay Using CopyandPay


In order to enable Apple Pay using CopyandPay, you need an Apple Development Account. Once you have created an account, you will then need to apply for the Apple Developer Program. Once done, follow the steps below:


  1. Configure your environment to allow Apple Pay Payments 

  2. Add the Apple Pay button to your Payment Pages


Configure Your Environment 


Configure your environment to accept Apple Pay Payments by completing the following steps:


  1. Create a Merchant ID

  2. Register and Verify Your Domain 

  3. Accept the Apple Pay Terms and Conditions as the Apple Developer account holder

  4. Send an email to support@peachpayments.com with APPLE PAY - YOUR COMPANY NAME in the subject to request an integration call to finalise the configuration process (adding your Apple Pay Merchant Identity Certificate and Payment Processing Certificate)



Once the above steps are completed, your application will be ready to accept Apple Pay payments using CopyandPay.


Add the Apple Pay Button to Your Payment Pages


Specify APPLEPAY as a brand when creating your payment in CopyandPay in order to display the Apple Pay button.


For Example

<form action="https://test.docs.oppwa.com/tutorials/integration-guide/fast-checkout#applePayCallbackFunction" class="paymentWidgets" data-brands="APPLEPAY"></form>


If a customer has a device that supports Apple Pay, an Apple Pay button will appear on their payment page. Once a customer clicks on the Apple Pay button an Apple Pay payment sheet will appear on their device. This payment sheet will trigger several events that can be handled using the CopyandPay API callback functions. You are also able to update data or steer the Apple Pay payment sheet using the CopyandPay API. 


Adding Apple Pay to Your Cart Page


CopyandPay also allows you to process Apple Pay payments even before a checkout ID has been generated. This method can allow a customer to be able to choose whether to immediately pay for their items using Apple Pay or continue with the normal checkout process.


Adding Apple Pay to your cart page requires a few extra steps:


  • Create a payment form on your cart page, however, omit the checkout ID when adding paymentWidgets.js to your HTML.

    For Example      

<script src="https://test.oppwa.com/v1/paymentWidgets.js"></script>


  • Define a callback function in wpwlOptions.createCheckout to create a checkout. 

    The callback function will be triggered once the Apple Pay button is clicked. The function should return a checkout ID, or a promise that will return a checkout ID. The returned object can be any thenable object. In particular, both JavaScript Promise and jQuery Promise are supported.


For Example

wpwlOptions.createCheckout = function() {
// Call your server to create a checkout
return $.post("https://your.server")
.then(function(response) {
// Assume that your server returned the response containing checkoutId
return response.checkoutId;
});
};


Note: You can use the callback function to check whether all prerequisites are met (e.g. terms and conditions are accepted) before starting the payment. If some conditions are not met, you can prevent Apple Pay from processing the payment by returning false.


Adding Apple Pay with the Mobile SDK


Before you begin adding Apple Pay using the Mobile SDK, you need an Apple Development Account. Once you have created an account, you will then need to apply for the Apple Developer Program. Once done, complete the following steps:

  1. Configure your environment

  2. Add Apple Pay to Your iOS App Using the Mobile SDK


Configure your Environment

  1. Create a Merchant ID

  2. Register and Verify Your Domain 

  3. Accept the Apple Pay Terms and Conditions as the Apple Developer account holder

  4. Send an email to support@peachpayments.com with APPLE PAY - YOUR COMPANY NAME in the subject to request an integration call to finalise the configuration process. (adding your Apple Pay Merchant Identity Certificate and Payment Processing Certificate)

  5. Integrate with XCode 




For a more detailed explanation of the steps outlined above, please refer to the official Apple Pay documentation here.


Once completing the steps above, your app should be ready to accept Apple Pay using our Mobile SDK.


Adding Apple Pay to Your iOS App Using the Mobile SDK


You are able to add the Apple Pay button to both our ready to use checkout screens and your own custom checkout screens in your iOS apps.


For a detailed explanation of how to add Apple Pay to Your iOS App Using the Mobile SDK, please click here.


Adding Apple Pay on the Web


You are able to add Apple Pay for Web to your website by using the Peach Payments Server-to-Server API. In order to enable Apple Pay for Web, you need an Apple Development Account. Once you have created an account, you will then need to apply for the Apple Developer Program. Once done, complete the following steps:

  1. Configure your environment

  2. Check for browser support

  3. Create an Apple Pay payment session 

  4. Display the payment sheet on the device

  5. Handle the onvalidatemerchant callback

  6. Handle the onpaymentauthorized callback




Configure Your Environment 


In order to integrate Apple Pay with Apple Pay on the Web, you will need to configure your environment by completing the following steps:

  1. Create a Merchant ID

  2. Register and Verify Your Domain 

  3. Generate an Apple Pay Merchant Identity Certificate

  4. Send an email to support@peachpayments.com with APPLE PAY - YOUR COMPANY NAME in the subject to request an integration call to finalise the configuration process (adding your Apple Pay Payment Processing Certificate)


Check for Browser Support 


Before showing the Apple Pay Button on your checkout page, you need to ensure that the device is capable of making Apple Pay payments and a card has been provisioned for Apple Pay.

Use the ApplePaySession.canMakePaymentsWithActiveCard method in order to validate both of those requirements. 


Create an Apple Pay Session


On the web, the Apple Pay payment process is managed by the ApplePaySession object. A new ApplePaySession should only be created when a customer explicitly asks to make a payment, for example, inside an onclick event. If a new ApplePaySession object is not requested when a customer explicitly requests a payment, a JavaScript exception is thrown.


Display the payment sheet on the device

To display the payment sheet on the device, call the ApplePaySession object’s begin method. This method is responsible for starting the merchant validation process. 

JavaScript

session.begin();


Handle the onvalidatemerchant callback


You are then required to define the ApplePaySession.onvalidatemerchant function from Apple JS API. The onvalidatemerchant function calls our server, and passes the static hostname apple-pay-gateway.apple.com as the validation URL.


Handle the onpaymentauthorized callback


The onpaymentauthorized event handler is called once the customer has authorized the Apple Pay payment with Touch ID, Face ID, or passcode.


The event parameter contains the payment (ApplePayPayment) attribute. ApplePayPayment contains billingContact and shippingContact if they were requested, and it also contains ApplePayPaymentToken.


You can send the encrypted payment token as-is. We will do the decryption and process the transaction. Send this token in the applePay.paymentToken parameter in the Server-to-Server API


Adding Apple Pay Using Checkout


In order to enable Apple Pay in Checkout or in our Wordpress, Magento, Wix or Shopify integrations, please contact our support team. 


Send an email to support@peachpayments.com with APPLE PAY ON CHECKOUT - YOUR COMPANY NAME in the subject for our support team to set up your account. 


Once enabled, an Apple Pay button will appear on the payment screen of all customers using supported devices.  The Apple Pay button allows customers to make payments using Apple Pay. Clicking on the Apple Pay button opens an Apple Pay payment sheet which enables customers to check their billing, shipping, and contact information and make the necessary changes. A customer then confirms payment on the sheet. When the payment is successful, the customer is shown a “Success” message and a checkmark on their screen and redirected back to the merchant website.


Testing Apple Pay


You are able to conveniently test your CopyandPay, Apple Pay on the Web and Checkout implementations using the Apple Pay sandbox environment. You are able to create as many test accounts as you would like using App Store Connect. Click here to find out how to create a sandbox tester account. 


A tester logs into a test account on their supported Apple device, and adds a test card to their Apple Pay wallet. A list of test cards can be found on Apple’s website. If the tester clicks the Apple Pay button on a checkout page, a payment sheet in test mode will appear. The tester is then able to go through the payment flow. 


Note: If you are using Checkout, please contact support to obtain your Apple Pay Merchant ID.



Brand Guidelines for Apple Pay


Apple requires all merchants who wish to use Apple Pay on the Web to follow certain brand guidelines when integrating Apple Pay with their websites.


All information regarding the Apple brand guidelines is readily available on the official Apple website. The Apple Pay marketing guidelines can be found here.


Customising the Apple Pay Button


If you are integrating Apple Pay using CopyandPay or Server-to-Server, you are able to customise your Apple Pay button using Apple Pay’s own CSS templates.


Additionally, if you are using CopyandPay, you can use the widget customisation options to customise the look and feel of your CopyandPay payment form. 


Please refer to the official Apple Pay brand guidelines when customising your Apple Pay button.


Terms and Conditions


Please note that Apple Pay is only available to merchants who meet Apple's acceptable use guidelines. Before integrating with Apple Pay, Merchants need to agree to the Apple Pay terms.