Skip to main content
Axelerant
Apple Pay Buttons - A Code Review
Image source: Retrieved from public internet sources. No copyright ownership claimed.

Apple Pay Buttons - A Code Review

, ,

Apple Pay is a mobile payment service by Apple Inc. It allows users to pay at merchant outlets who support contactless payments and also perform checkout on e-commerce websites & iOS apps. It uses a combination of biometric and code-based authentication methods as part of its two-factor authentication protocols.

Launched initially as a mobile-only service, it eventually went on to include support for newer Apple devices like MacBook Pro and MacBook with Touch ID. Apple Pay integration can be done in apps as well as in websites. With Apple Card launching this summer, it is more likely that customers will want to stick with the Apple ecosystem for e-commerce payments. This scenario will make Apple Pay integration even more vital for e-commerce websites.

Apple Pay buttons

Apple Pay payment or checkout is invoked using the Apple Pay buttons. In this article, we are going to focus only on the website integration on the front-end side.

Assuming all setup work is done for your website, you should get to the Human Interface Guidelines as part of your work. The setup work must include provisioning of an Apple developer account, a public URL, and general compliance for integrating with Apple Pay.

Here you will see all the different types of Apple Pay buttons you can display on your website. Going further into the documentation, you will find the code that you need to embed to render the Apple Pay buttons on your website.

Here are a few things you need to know:

  1. Apple Pay only works in Safari.
  2. Apple Pay only works on devices with Touch ID; for some older iPads and MacBooks without Touch ID, you need an Apple Watch and/or iPhone with Touch ID.
     

A complete compatibility list is available here.

Apple Pay button HTML code

With the above code in your website, it should magically render an Apple Pay button, provided you also add the respective button CSS given by Apple (an example is shared below).
Apple%20Pay%20Button

 

Let’s analyze the HTML code:

The HTML semantically doesn’t shout button at all. In fact the

further has nested
which seems unnecessary.

One good thing here is that Apple has not hardcoded the

part in the code or in the CSS they provide. You are free to use
 

About the Author

Swarad Mokal, Technical Program Manager

Swarad Mokal, Technical Program Manager

Leave us a comment