Payment-method icon

Apple Pay for API only

Add Apple Pay to an existing API-only integration.

Accept Apple Pay payments using our APIs, and build your own payment form to have full control over the look and feel of your checkout page.

Requirements

Requirement Description
Integration type Make sure that you have an existing Advanced flow API-only integration.
API credential roles To process live Apple Pay payments make sure that you have the following role
  • API Clientside Encryption Payments role.
Setup steps Before you begin, make sure that you have:
  • Set up Apple Pay with your own or Adyen's Apple Pay certificate.
    You can use Adyen's Apple Pay certificate if you have a web integration, which makes it quicker to set up Apple Pay. If you have a mobile integration, use your own Apple Developer account and certificate which requires extra configuration steps.
  • Added Apple Pay in your Customer Area.

Build your payment form for Apple Pay

After you have finished setting up Apple Pay, you can show Apple Pay as an available payment method in countries/regions where Apple Pay is supported. You can download logos for Apple Pay which you can use on your payment form.

When the shopper selects Apple Pay, they are presented with a prompt to verify the payment using Touch ID or Face ID. If the shopper is using a Mac without Touch ID, they will be prompted to verify the payment using an iPhone or Apple Watch registered to the same iCloud account.

  1. Make a /paymentMethods request, specifying:

    • countryCode: Countries/regions where Apple Pay is supported. For example, NL.
    • amount.currency: Any supported currency. For example, EUR.
    • channel: Set this to Web if the payment is being initiated from Safari, or iOS for in-app payments.
  2. In the response, you receive:

{
  "paymentMethods": [
    ...
    {
        "brands": [
            "amex",
            "mc"
        ],
        "configuration": {
            "merchantId": "com.test.merchant",
            "merchantName": "Your Store"
        },
        "details": [
            {
                "key": "applepay.token",
                "type": "applePayToken"
            }
        ],
        "name": "Apple Pay",
        "type": "applepay"
    },
    ...
  ]
}

Complete the Apple Pay session validation

When the shopper selects to pay with Apple Pay, you get the onvalidatemerchant event handler. You then need to complete the Apple Pay session validation using the completeMerchantValidation method.

You can do this by using Adyen's Apple Pay certificate, or you can use your own:

The Apple Pay session data expires after five minutes, so make sure you complete the Apple Pay session validation within this time.

If the Apple Pay session is successfully validated, Apple Pay prompts the shopper to authorize the payment using Touch ID or Face ID.

Make a payment

  1. After the shopper authorizes the payment, get the token from the Apple Pay framework and decrypt it in one of two ways:

  2. Stringify and Base64-encode the entire paymentData object.

  3. From your server, make a /payments request providing:

    • paymentMethod.type: applepay
    • applePayToken: The stringified and base64 encoded paymentData you retrieved from the Apple framework.