Requirements
Select which endpoint you are using:/sessions/payments/sessions/payments- Sessions flow
- Advanced flow
- v6 and later
- v5 and earlier
- Use Adyen's Apple Pay certificate
- Use your own Apple Pay certificate
| Requirement | Description |
|---|---|
| Integration type | Make sure that you have built a Sessions flow Web Drop-in integration. |
| API credential roles | To process live Apple Pay payments make sure that you have the following role: API Clientside Encryption Payments role. |
| Customer Area roles | Change payment methods role. |
| Limitations | Offering Apple Pay on web requires additional configuration if you show Apple Pay inside an iframe element. On v6.10.0 and later of Drop-in, you can offer Apple Pay on all supported third-party browsers. For earlier versions, you can only offer Apple Pay on certain browsers, see compatibility to learn about limitations per device. |
| Setup steps | Before you begin, make sure that you have: Added Apple Pay in your Customer Area, and set up Apple Pay with your own or Adyen’s certificate. Set up your server to allow Apple Pay IP addresses. |
| Requirement | Description |
|---|---|
| Integration type | Make sure that you have built an Advanced flow Web Drop-in integration. |
| API credential roles | To process live Apple Pay payments make sure that you have the following role- API Clientside Encryption Payments role. |
| Customer Area roles | Change payment methods role. |
| Limitations | Offering Apple Pay on web requires additional configuration if you show Apple Pay inside an iframe element. On v6.10.0 and later of Drop-in, you can offer Apple Pay on all supported third-party browsers. For earlier versions, you can only offer Apple Pay on certain browsers, see compatibility to learn about limitations per device. |
| Setup steps | Before you begin, make sure that you have: Added Apple Pay in your Customer Area, and set up Apple Pay with your own or Adyen’s certificate. Use Apple’s test cards and a Sandbox tester Apple ID when testing in Adyen TEST. An Apple Developer account is required to create Sandbox testers and manage configuration, even when using Adyen’s certificate. If you use your own Apple Pay certificate, complete Apple’s domain verification for each domain where you offer Apple Pay. |
Offering Apple Pay on web
When offering the option to pay with Apple Pay on web, there are additional things to consider if you use iframe elements. If you want to show Apple Pay on browser other than Safari, see compatibility to learn which devices and operating systems support this feature.Apple Pay with iFrames
To show Apple Pay in an iframe element when the shopper is using Safari as their browser:-
For shoppers on Safari 17 later: add the
allowattribute to the iframe to let the iframe communicate correctly with Apple Pay APIs:Safari 17 is available on iOS 17 and later, and macOS 12 and later.<iframe allow="payment"> </iframe> - For shoppers on Safari 16 or earlier: match the iframe origin and your top-level origin. The protocols, hosts (full domain name), and ports, when specified, must be the same for both pages.
Device compatibility
On v6.10.0 and later versions of Drop-in, you can offer Apple Pay on all supported third-party browsers, platforms, and devices, including Windows and Chromebooks. Shoppers can now initiate Apple Pay payments from any compatible device and complete their payment by scanning a code. See Devices compatible with Apple Pay on Apple Pay documentation.On earlier versions of Drop-in , the support for Apple Pay on third-party browsers differ per shopper device:- MacOS devices: available on Safari.
- iOS and iPadOS devices: available on all browsers, including web views.
- Non-Apple devices: not available.
API reference
You do not need to send additional fields for Apple Pay. To see optional fields that you can send for all payment methods, choose the endpoint you integrated:- /sessions: This is the default with Drop-in v5.0.0 or later.
- /payments: If you implemented an additional use case.
Drop-in configuration
Select which endpoint you are using:This is the default with Drop-in v5.0.0 or later.If you are using
/sessions together with Adyen’s Apple Pay certificate, you do not need to add any additional configuration for Apple Pay.If using your own Apple Pay certificate, you need to include:onValidateMerchant: Required for displaying the Apple Pay payment sheet. For more information, see Apple Pay documentation.
const dropin = new Dropin(checkout, {
// ...Other Drop-in configuration.
paymentMethodsConfiguration: {
// Configuration object for Apple Pay.
applepay: {
onValidateMerchant: (resolve, reject, validationURL) => {
// Your server uses the validation URL to request a session from the Apple Pay server.
validateMerchant(validationURL)
.then(response => {
// Complete merchant validation with resolve(MERCHANTSESSION) after receiving an opaque merchant session object, MerchantSession
resolve(response);
})
.catch(error => {
// Complete merchant validation with reject() if any error occurs
reject();
});
},
// ...Other Apple Pay configuration.
}
}
});
If you are using
/payments together with Adyen’s Apple Pay certificate, you do not need to add any additional configuration for Apple Pay.If using your own Apple Pay certificate, you need to include:onValidateMerchant: Required for displaying the Apple Pay payment sheet. For more information, see Apple Pay documentation.
const dropin = new Dropin(checkout, {
// ...Other Drop-in configuration.
paymentMethodsConfiguration: {
// Configuration object for Apple Pay.
applepay: {
onValidateMerchant: (resolve, reject, validationURL) => {
// Your server uses the validation URL to request a session from the Apple Pay server.
validateMerchant(validationURL)
.then(response => {
// Complete merchant validation with resolve(MERCHANTSESSION) after receiving an opaque merchant session object, MerchantSession
resolve(response);
})
.catch(error => {
// Complete merchant validation with reject() if any error occurs
reject();
});
},
// ...Other Apple Pay configuration.
}
}
});
Optional configuration
This optional configuration parameter is only accepted on thedropin instance.Instant payment button configuration
Use theinstantPaymentTypes object to display the Apple Pay payment button at the top of the list of available payment methods. The sample below shows how to do this:Optional Drop-in instance configurationconst dropin = new Dropin(checkout, {
instantPaymentTypes: ['applepay']
}).mount('#dropin-container');
Optional Apple Pay configuration
You can do the following:- Configure the appearance of the Apple Pay button.
- Include additional data such as transaction information, fields for billing and shipping contact information.
- Configure how to render Apple Pay code.
- Add logic for specific events on your payment form.
Button configuration
| Property | Description |
|---|---|
buttonType | The type of button you want to show on your payments form. Possible values: - plain: Apple Pay - buy: Buy with Apple Pay - donate: Donate with Apple Pay - check-out: Check out with Apple Pay - book: Book with Apple Pay - subscribe: Subscribe with Apple Pay The following types are supported from Web Components v4.1.0: - add-money: Add money with Apple Pay - contribute: Contribute with Apple Pay - order: Order with Apple Pay - reload: Reload with Apple Pay - rent: Rent with Apple Pay - support: Support with Apple Pay - tip:Tip with Apple Pay - top-up: Top Up with Apple Pay |
buttonColor | Specify the color of the button you want displayed on the payment form. Possible values: - black: Black button - white: White button with no outline - white-outline: White button with black outline |
buttonLocale | Specify the locale to set the language for the Apple Pay button. For possible values, see Apple Pay documentation. |
Payment request data
| Payment request data | Configuration object | Description |
|---|---|---|
| Transaction information | version | Check the Apple Pay on the Web documentation for version features and compatibility details. |
totalPriceLabel | String. Description of the line item. | |
lineItems | A set of line items that explain recurring payments, additional charges, and discounts. Refer to Apple Pay documentation for sample values. | |
merchantCapabilities | Payment capabilities supported by the merchant. Default value is [supports3DS]. Refer to Apple Pay documentation for other options. | |
shippingMethods | List of available methods for shipping physical goods. Refer to Apple Pay documentation for sample values. | |
shippingType | Optional value that indicates how purchased items are to be shipped. Refer to Apple Pay documentation for available options. | |
supportedCountries | Specify the ISO 3166 country codes if you only support payments from cards issued in specific countries. | |
| Requested billing and shipping contact information | requiredBillingContactFields | The billing address associated with the shoppers payment method. The only allowed field is postalAddress. |
requiredShippingContactFields | Shipping information fields that you require from the shopper to fulfill the order. Use this field to get the shopper’s email or phone number from the Apple Pay payment sheet. Refer to Apple Pay documentation for sample values. | |
shippingContactEditingMode v6.13.0 or later | Set to storePickup for in-store or other pickup shipping options to prevent the shopper from editing the shipping address field. | |
| Known contact information | billingContact | Set an up-to-date billing contact information for the shopper. |
shippingContact | Set an up-to-date shipping contact information for the shopper. | |
| Custom data | applicationData | A Base64-encoded string used to contain your application-specific data. For example, a shopping cart identifier or an order number that you will need to identify this transaction. |
| Recurring payments | recurringPaymentRequest | Required for recurring payments. Include to specify that the payment is a recurring payment. |
Code rendering configuration
| Property | Description |
|---|---|
renderApplePayCodeAs | Specify whether the Apple Pay code is rendered as a modal, or pop-up window within the page when using Apple Pay in a browser other than Safari. Possible values: - modal: This is the default when the Apple Pay Component is not embedded in an iframe. - window: This is the default when the Apple Pay Component is embedded in an iframe. |
Events
The following event handlers are supported for Apple Pay. Select the event handler names to see the related Apple Pay documentation.| Event | Description |
|---|---|
onClick(resolve, reject) | Called when the shopper clicks the Apple Pay button. Call resolve() to continue or reject() to stop the payment flow. |
onValidateMerchant(resolve, reject, validationURL) | Required if you use your own Apple Pay certificate. Called when the payment sheet is displayed. See Apple Pay documentation for more information. |
onAuthorized(data, actions) | Called after the shopper authorizes the payment with Apple Pay. This contains the raw event from Apple Pay, and the raw event from Apple Pay pre-formatted by our Web SDK. Call actions.resolve() to continue or actions.reject() to stop the payment flow. See Apple Pay documentation for more information. |
onPaymentMethodSelected(resolve, reject, event) | Called when the shopper selects a new payment method. Call resolve() or reject(), passing the ApplePayPaymentMethodUpdate object. See Apple Pay documentation for more information. |
onShippingContactSelected(resolve, reject, event) | Called when the shopper selects a shipping contact. Call resolve() or reject(), passing the ApplePayPaymentMethodUpdate object. See Apple Pay documentation for more information. |
onShippingMethodSelected(resolve, reject, event) | Called when the shopper selects a shipping method. Call resolve() or reject(), passing the ApplePayPaymentMethodUpdate object. See Apple Pay documentation for more information. |
onApplePayCodeClose | Called when the Apple Pay code modal or window closes. |
Optional Apple Pay Wallet Order Tracking
Supported in v6.0.0 or later.You can use Apple Pay Wallet Order Tracking to give your shopper order tracking through Apple Pay. For more information, refer to the following resources from Apple:- Apple Pay Wallet Order Tracking Demo
- Apple Pay Tech Talk about implementing Apple Pay with order management
- Example Order Packages
-
Implement
onOrderTracking: Implement order trackingconst applepay = new ApplePay(checkout, { onOrderTrackingRequest: async (resolve, reject) => { try { // Request the order details from your server. const order = await server.getOrder(); // Pass the order details to Drop-in. const orderDetails = { orderTypeIdentifier: order.orderTypeIdentifier, orderIdentifier: order.orderIdentifier, webServiceURL: order.webServiceURL, authenticationToken: order.authenticationToken }; resolve(orderDetails); } catch (error) { // If you cannot get the order, call the reject function. reject(); } } }); -
When
onOrderTrackingis called depends on which server-side flow your integration uses.
After the payment is complete, Drop-in calls
onOrderTracking.After
onSubmit is resolved, Drop-in calls onOrderTracking.- From your server, get the order details and pass it as
orderDetailsto your client side.
If an error occurs, the Apple Pay payment overlay is closed, and the payment is successfully completed without creating an order in the shopper’s Apple Wallet app.
Optional Apple Pay capabilities check
Supported in v6.10.0 or later.You can use theapplePayCapabilities method to check whether the device supports Apple Pay and if the shopper has an active card in their wallet for web payments. You can then configure when to offer Apple Pay depending on the available payment methods in your shopper’s wallet. This is only recommended if you display Apple Pay on the product page.To implement applePayCapabilities:applepay.applePayCapabilities().then(capabilities => {
// Check whether the person has an active payment method in their wallet.
switch (capabilities.paymentCredentialStatus) {
case "paymentCredentialsAvailable":
// Display an Apple Pay button and offer Apple Pay as the primary payment option.
case "paymentCredentialStatusUnknown":
// Display an Apple Pay button and offer Apple Pay as a payment option.
case "paymentCredentialsUnavailable":
// Optionally, display an Apple Pay button.
case "applePayUnsupported":
// Do not show an Apple Pay button or offer Apple Pay.
}
});
Recurring payments
Apple Pay supports tokenization for recurring transactions on v5.39.0 and later.We strongly recommend that you ask explicit permission from the shopper if you intend to make future recurring payments. Being transparent about the payment schedule and the charged amount reduces the risk of chargebacks.To enable recurring payments, you must includerecurringPaymentRequest when configuring Apple Pay.Example recurringPaymentRequest configuration
const applepayComponent = new ApplePay(checkout {
recurringPaymentRequest: {
paymentDescription: "Merchant tokens Adyen test",
managementURL: "https://www.adyen.com/",
tokenNotificationUrl: "https://www.adyen.com/tokenNotificationUrl",
regularBilling: {
label: "Subscription",
amount: "20.00",
type: "final",
paymentTiming: "recurring",
recurringPaymentStartDate: new Date("2023-12-01T00:00:00"),
recurringPaymentIntervalUnit: "month",
recurringPaymentIntervalCount: 4,
recurringPaymentEndDate: new Date("2024-03-01T00:00:00"),
},
trialBilling: {
label: "Trial billing",
amount: "10.00",
type: "final",
paymentTiming: "recurring",
recurringPaymentStartDate: new Date("2023-11-01T00:00:00"),
recurringPaymentIntervalUnit: "month",
recurringPaymentIntervalCount: 1,
recurringPaymentEndDate: new Date("2023-12-01T00:00:00"),
}
},
});
Example recurringPaymentRequest configurationFor more context and explanation of parameters, refer to Apple developer documentation.To make recurring payments, refer to Tokenization to:
const applepayComponent = checkout.create('applepay', {
recurringPaymentRequest: {
paymentDescription: "Merchant tokens Adyen test",
managementURL: "https://www.adyen.com/",
tokenNotificationUrl: "https://www.adyen.com/tokenNotificationUrl",
regularBilling: {
label: "Subscription",
amount: "20.00",
type: "final",
paymentTiming: "recurring",
recurringPaymentStartDate: new Date("2023-12-01T00:00:00"),
recurringPaymentIntervalUnit: "month",
recurringPaymentIntervalCount: 4,
recurringPaymentEndDate: new Date("2024-03-01T00:00:00"),
},
trialBilling: {
label: "Trial billing",
amount: "10.00",
type: "final",
paymentTiming: "recurring",
recurringPaymentStartDate: new Date("2023-11-01T00:00:00"),
recurringPaymentIntervalUnit: "month",
recurringPaymentIntervalCount: 1,
recurringPaymentEndDate: new Date("2023-12-01T00:00:00"),
}
},
});
- Create a token through the initial payment
- Use the token in subsequent payments.
- Manage tokens.
Test and go live
Use Apple’s test card numbers to test your integration.For a full list of test cards and instructions how to add these to your test device, see Sandbox testing on Apple’s Developer website.Check the status of an Apple Pay test payment in your Customer Area > Transactions > Payments.Going live
To process live Apple Pay payments, your API credential needs to have the API Clientside Encryption Payments role. You can check this in your live Customer Area or ask your Admin user to verify.- Download and unzip the domain association file.
-
Host the domain association file on each domain you want to use, including subdomains. To host the file, use the exact file name apple-developer-merchantid-domain-association under the following path:
The file must:
/.well-known/apple-developer-merchantid-domain-association- Have
Content-Type: text/plainin the header. - Be externally accessible.
- Not be password protected.
- Not be behind a proxy or redirect.
- Have
-
Add Apple Pay in your live Customer Area
- You’ll be asked for Shop websites: your website URLs, for example
https://www.mystore.com. If you add more than one, separate them with a comma.
- You’ll be asked for Shop websites: your website URLs, for example
-
To update or add new Apple Pay domains:
- Go to live Customer Area > Payment Methods.
- Select the specific Apple Pay payment method you want to update.
-
In the sidebar on the right, go to the Apple Pay domains section to find a list of domains currently configured for this payment method. To update the domains, select the Edit button next to the Apple Pay domains heading.
A new sidebar opens where you can make the necessary changes. If there are any errors, this is indicated with red dot. -
To view and fix any errors, select Edit next to the affected domain.
- You must be assigned the Change payment methods role in Customer Area to be able to make domain updates.
- Domain configuration updates apply only to the generic Apple Pay payment method. Scheme-specific variants, like AMEX Apple Pay, Visa Apple Pay, and Mastercard Apple Pay, do not require domain configuration and are not supported by this flow.
- Set up Apple Pay on your Apple Pay Developer account for your live merchant identifier.
-
Configure your firewall’s allow-list:
- Allow Apple IP Addresses for Domain Verification
- Include
out.adyen.comin your configuration to allow communication from our network.
out.adyen.com, and then add those IP addresses to your allow-list. Beware that you still run the risk of a disruption if the IP addresses change.