Apple Pay JS

Use JavaScript to incorporate Apple Pay into your websites.


The Apple Pay JS API lets you accept Apple Pay payments on the web. The Apple Pay JS API is supported on the following platforms:

  • iOS 10 and later. Apple Pay JS is supported on all iOS devices with a Secure Element. It is supported both in Safari and in SFSafariViewController objects.

  • macOS 10.12 and later. Apple Pay JS is supported in Safari. The user must have an iPhone or Apple Watch to authorize the payment, or a MacBook Pro with Touch ID.

Apple Pay is available in supported regions.

The Apple Pay JS API is analogous to the PassKit framework for using Apple Pay in apps. If you have used the PassKit API, then the Apple Pay JS API should feel familiar to you.

Sample code is available here: EmporiumWeb: Request and handle Apple Pay payments on the web.

Apple Pay Requirements

There are three requirements for using Apple Pay on your website:


First Steps

Setting Up Your Server

Set up your server for secure communications with Apple Pay.

Configuring Your Environment

Create your Apple Pay merchant ID and certificates, and verify your domain.

Maintaining Your Environment

Prevent interruptions in your Apple Pay service by keeping certificates and domain verification current.

Apple Pay Availability

Checking for Apple Pay Availability

Verify that the Apple Pay JS API is available and that payments are possible.


Indicates whether the device supports Apple Pay.


Indicates whether the device supports Apple Pay and whether the user has an active card in Wallet.

Apple Pay Buttons

Displaying Apple Pay Buttons

Use CSS templates to display Apple Pay buttons on your webpage.

Choosing Button Appearance

Choose a button color and size to suit your web page.

Localizing Apple Pay Buttons

Set the language of an Apple Pay button.

Payment Request


A request for payment, which includes information about payment processing capabilities, the payment amount, and shipping information.

Apple Pay Session

Creating an Apple Pay Session

Provide a payment request and create the session.

Providing Merchant Validation

Validate your merchant identity and receive a session object for each payment request.

Requesting an Apple Pay Payment Session

Request a valid session from the Apple Pay server.


A session object for managing the payment process on the web.

Status and Errors


A customizable error type that you create to indicate problems with the address or contact information on an Apple Pay sheet.


The error code that indicates whether an error on the payment sheet is for shipping or billing information, or for another kind of error.


Names of the fields in the shipping or billing contact information, used to locate errors in the payment sheet.

Apple Pay Status Codes

Codes used to report the status of an Apple Pay session after a callback.