Apple Pay®

Apple Pay allows customers to securely complete payments using credit or debit cards linked to their Apple account. Evervault has built-in support for Apple Pay. Our Apple Pay component will intercept the Apple Pay token and provide you with direct access to the encrypted payment method, which can then be sent to any payment processor using Relay.

Getting Started


All users of Apple pay must adhere to the Apple Pay Terms and Conditions.

Create a Merchant


Before you can use Apple Pay, you will need to create a Merchant record to use for the transaction. You can create a Merchant from inside the payments tab in the Evervault Dashboard or via the Merchants API.

Verify your domain with Apple


After creating a merchant, Apple will need to verify the domains you have associated with that merchant. In order to verify your domain, you will need to ensure this identifier file is served from /.well-known/apple-developer-merchantid-domain-association on your domain.

Once you have uploaded the identifier file, you can register the domain with Apple using the Merchant detail page in the Evervault Dashboard or via the Merchant API.

You can check the status of your domain verification with Apple via the Dashboard or by using the Merchant API. It may take up to 10 minutes for the verification to complete.

Reverification

Once a domain is verified, you must ensure that the validation token is always available at the specified URL. If the validation token is not available when Apple periodically attempts to retrieve it, Apple will not be able to verify the domain, and Apple Pay will not work on your website.

Install the SDK


Our JavaScript SDK is distributed from our CDN, and can be installed by placing this script tag in the head of your HTML file. The SDK must be loaded directly from our CDN and cannot be bundled with your application or self hosted.

Once the SDK is installed, initialize it using your Team ID and App ID. You can find these in the Evervault Dashboard.

You can also install Evervault via the @evervault/js package on npm. This package is a light wrapper which handles loading the SDK from our CDN and also provides TypeScript definitions.

Frequently Asked Questions

Create a transaction


Next, you will need to create a transaction to describe the payment you want to process. You will need to provide the amount, currency, country, and merchant details for the transaction. With Apple Pay a transaction can be a Payment Transaction or a Disbursement Transaction. You can pass either transaction type to the Apple Pay component.

Mount the Apple Pay component


Now that you have created a transaction, you can create and mount the Apple Pay component to display the Apple Pay button to your users. The Apple Pay component takes the transaction you created as a first argument and an options object with a process function that will be called with the encrypted payment method when the user completes the payment. The process function is an async function that takes the encrypted payment method as the first argument and an object with a fail function as the second argument. The fail function can be called with an error message to display an error to the user.

Availability

There are several requirements that must be met for Apple Pay to be available on the device. If you are having issues with the Apple Pay component not rendering, please check the Availability section below to ensure your device meets all the requirements.

Process the payment


The process function is called when the user authorizes the payment. This is where you should finalize the payment with your payment processor. The encrypted payment method will be passed to the process function as the first argument. This should be sent to your backend which can then use Relay to safely send the decrypted payment method to any payment provider.

The full encrypted payment method object contains the following data:

Use Apple Pay with your PSP


You can use Evervault's Apple Pay integration with any PSP. This means you:

  • Don't use your PSP's Apple Pay integration.
  • Use network tokens (provided by Evervault) with your PSP's APIs.

Evervault generates network tokens for Apple Pay transactions, not your PSP. After you have the network token, use it for all payments, retries, etc. with your PSP. There's no additional configuration (e.g., certificates) with your PSP or Apple needed. Most PSPs have network token APIs and parameters for passing network token data. Like other 3rd party API calls, use Relay to decrypt network token data and send it to your PSP.

Availability


You can use the availability method to check if Apple Pay is available on the device. This method returns a promise that resolves to a string indicating the availability status.

  • available - Apple Pay is available on the device.
  • unavailable - Apple Pay is supported but not currently available on the device.
  • unsupported - Apple Pay is not supported on the device.

In order for Apple Pay to be available, the user's device or browser must meet the following requirements:

  • The web page must be served over HTTPS.
  • Have at least one card added to their Apple Wallet.
  • The user must be using a compatible browser. Apple Pay is supported on Safari, Chrome, and Edge.
  • If using Safari:
    • The user must have Apple Pay enabled in their browser settings. Settings > Advanced > Allow websites to check for Apple Pay and Apple card.
    • The user must have access to the biometric authentication controls on their device. If using a laptop this means the laptop must not be in clamshell mode and the user must have access to the Touch ID sensor.

Customization


Apple Pay allows you to customize the appearance of the payment button with various predefined styles. These can be passed as additional options when initializing the Apple Pay component. You can see the available options in the JS SDK documentation.

Configure card networks


Apple Pay allows you to specify the card networks that are supported by your merchant. This can be done by passing the allowedCardNetworks options when initializing the Apple Pay component. You can see the available options in the Apple Pay Docs. Please check with your payment processor to ensure that the card networks you specify are supported.

Transaction updates


Apple Pay allows you to update the transaction after a user has launched the Apple Pay modal. This can be done by leveraging the options described below.

Responding to shipping address changes


You may want to alter the transaction amount based on the shipping address provided by the user. Apple Pay allows you to respond to changes in the shipping address after a user has launched the Apple Pay modal. This can be done by passing the requestShipping and onShippingAddressChange options when initializing the Apple Pay component. The onShippingAddressChange function should return an object with an updated amount and lineItems array.

Responding to billing address changes


You can leverage the requestBillingAddress and onPaymentMethodChange options when initializing the Apple Pay component to respond to changes in the billing address.

Due to limitations in the Apple Pay API, if also requesting a shipping address, the onPaymentMethodChange event will not return the billing address.

Updating a transaction when Apple Pay is triggered


In some scenarios, you might want to perform an action before presenting the Apple Pay modal to the user, e.g., offering a discount code. You can do this by passing the prepareTransaction option when initializing the Apple Pay component. The prepareTransaction function should return a promise that resolves to an object with an updated amount and lineItems array.

Content security policy (CSP)


If you are using a Content Security Policy (CSP), you will need to add the following directives to allow the Evervault SDK to function correctly.

Notes


  • The Apple Pay UI Component is currently not supported on devices in Mainland China.
  • The Apple Pay UI Component requires a secure context (HTTPS) to function correctly.