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
|
Setup steps | Before you begin, make sure that you have:
|
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.
-
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.
-
In the response, you receive:
type
: applepay.merchantId
andmerchantName
: If you use Adyen's Apple Pay certificate, you need these details in the next step to complete the Apple Pay session validation.
{
"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
-
After the shopper authorizes the payment, get the token from the Apple Pay framework and decrypt it in one of two ways:
- Let Adyen handle the decryption
- Handle the decryption yourself. This is only allowed if you are PCI-compliant.
-
Stringify and Base64-encode the entire
paymentData
object. -
From your server, make a /payments request providing:
paymentMethod.type
: applepayapplePayToken
: The stringified and base64 encodedpaymentData
you retrieved from the Apple framework.