On this page, you can find additional configuration for adding Apple Pay to your Components integration.
Before you begin
This page assumes you have already built a Components integration.
Set up Apple Pay
Enable Apple Pay with your own or Adyen's Apple Pay certificate.
API reference
You don't 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 Components v5.0.0 or later.
- /payments: If you implemented an additional use case.
If you run into an error, refer to Handle Apple Pay errors.
Component configuration
Step 1: Create a DOM element
Create a DOM element on your checkout page, placing it where you want the payment method form to be rendered:
<div id="applepay-container"></div>
Step 2: Create an instance of the Component
Select which endpoint you're integrating:
This is the default with Components v5.0.0 or later.
If you are using /sessions
together with Adyen's Apple Pay certificate, you don't 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.
The following example shows how to configure the Apple Pay Component if you're using your own Apple Pay certificate:
Use the create
method of your AdyenCheckout
instance, in this case checkout
, to create the Component. Pass the configuration object if you created one:
const applePayComponent = checkout.create('applepay', applePayConfiguration);
Step 3: Mount the Component
Mount the Component only after checking that Apple Pay is available to the shopper:
applePayComponent
.isAvailable()
.then(() => {
applePayComponent.mount("#applepay-container");
})
.catch(e => {
//Apple Pay is not available
});
Optional 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.
- Add logic for specific events on your payment form.
Button configuration
Property | Description |
---|---|
buttonType |
The type of button you want displayed 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-with-line: White button with black outline |
Payment request data
Payment request data | Configuration object | Description |
---|---|---|
Transaction information |
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 |
Billing information fields that you require from the shopper to process the transaction. Refer to Apple Pay documentation for sample values. |
|
Shipping information fields that you require from the shopper to fulfill the order. Refer to Apple Pay documentation for sample values. |
||
Known contact information |
Set an up-to-date billing contact information for the shopper. |
|
Set an up-to-date shipping contact information for the shopper. |
||
Custom data |
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 |
Include to specify that that payment is a recurring payment. |
Events
The following event handlers are supported for Apple Pay. Select the event handler names to see the related Apple Pay documentation.
Event | Description |
---|---|
|
Called when the shopper clicks the Apple Pay button. Call |
|
Called when the payment sheet is displayed. For more information, see Apple Pay Documentation. |
|
Also called after the shopper authorizes the payment with Apple Pay. This contains all the raw event from Apple Pay. For more information, see Apple Pay Documentation. |
|
Called when the shopper selects a new payment method. For more information, see Apple Pay Documentation. |
|
Called when the shopper selects a shipping contact. For more information, see Apple Pay Documentation. |
|
Called when the shopper selects a shipping method. For more information, see Apple Pay Documentation. |
Use the create
method of your AdyenCheckout
instance, in this case checkout
, to create an instance of the Component. Add the configuration object if you created one.
const applePayComponent = checkout.create('applepay', applePayConfiguration).mount('#applepay-container');
Recurring payments
To make recurring Apple Pay payments, you first need to create a shopper token and then make subsequent recurring transactions with the token. You also must include recurringPaymentRequest
when configuring Apple Pay.
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.
To create an Apple Pay sandbox environment and test payments, you need an Apple Developer account. This also applies if you're using Adyen's Apple Pay certificate.
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.
Make sure you follow Apple's guidelines on:
-
Download and unzip the domain association file.
-
Host the domain association file with the name apple-developer-merchantid-domain-association on each domain you want to use, including subdomains, under the following path:
/.well-known/apple-developer-merchantid-domain-association
The file must:
- Have
Content-Type: text/plain
in the header. - Be externally accessible.
- Not be password protected.
- Not be behind a proxy or redirect.
- Be hosted with the Unix line ending.
See an example of a working domain association file.
- Have
-
Add the following IP addresses to your firewall's allow list:
- Allow Apple IP Addresses for Domain Verification
- Any IP originating from
*.adyen.com
-
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