Requirements
Select which endpoint you are using:/sessions/payments- v5.3.0 or later
- v5.0.0 to v5.2.0
- v4.x.x
- v5.0.0 or later
- v4.x.x
| Requirement | Description |
|---|---|
| Integration type | Make sure that you have built a Sessions flow iOS 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. |
| Setup steps | Before you begin, make sure that you have: Set up Apple Pay with your own certificate. Added Apple Pay in your Customer Area. |
| Requirement | Description |
|---|---|
| Integration type | Make sure that you have built an Advanced flow iOS 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. |
| Setup steps | Before you begin, make sure that you have: Set up Apple Pay with your own certificate. Added Apple Pay in your Customer Area. |
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
When you configure Drop-in, you need additional configuration for Apple Pay.Include the following when you configure Drop-in:
Create the configuration object
| Parameter name | Description |
|---|---|
paymentRequest | Your Apple Pay PKPaymentRequest object. |
merchantIdentifier | Your Apple Pay merchant identifier. |
//Initialize a Drop-in configuration object.
let dropInConfiguration = DropInComponent.Configuration()
//Set configuration for Apple Pay.
let paymentRequest: PKPaymentRequest
// Initiate PKPaymentRequest
dropInConfiguration.applePay = try? .init(paymentRequest: paymentRequest)
Include the following when you configure Drop-in:
Create the configuration object
| Parameter name | Description |
|---|---|
merchantIdentifier | Your Apple Pay merchant identifier. |
//Initialize a Drop-in configuration object.
let dropInConfiguration = DropInComponent.Configuration()
//Set configuration for Apple Pay.
dropInConfiguration.applePay = .init(payment: applePayment,
merchantIdentifier: "YOUR_APPLE_PAY_MERCHANT_ID")
If your integration uses Drop-in v4.10.0 or earlier, include following configuration for Apple Pay:
Create the configuration object
| Parameter name | Description |
|---|---|
merchantIdentifier | Your Apple Pay merchant identifier. |
payment | The amount, currency, and country code of the payment. |
summaryItems | The items included in the purchase. |
// Import this to use the PKPaymentSummaryItem class
// See documentation https://developer.apple.com/documentation/passkit/pkpaymentsummaryitem
import PassKit
//Submit the payment details here, including the amount, currency, and country code
let payment = Payment(amount: Amount(value: 15000, currencyCode: "EUR"),
countryCode: "NL")
// A set of line items that explain recurring payments, additional charges, and discounts.
// See Apple Pay documentation for sample values.
// https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/1916120-lineitems
let summaryItems = [
PKPaymentSummaryItem(label: "Jeans", amount: 98.99, type: .final),
PKPaymentSummaryItem(label: "Bag", amount: 55.46, type: .final),
PKPaymentSummaryItem(label: "Discount", amount: -4.45, type: .final),
PKPaymentSummaryItem(label: "Total", amount: 150, type: .final)
]
// See Apple Pay documentation https://docs.adyen.com/payment-methods/apple-pay/apple-pay-certificate/ios#create-merchant-identifier
let merchantIdentifier = "merchant.com.{YOUR_MERCHANT_IDENTIFIER}"
let applePayConfiguration = ApplePayComponent.Configuration(summaryItems: summaryItems,
merchantIdentifier: merchantIdentifier)
//Assign the Apple Pay configuration object you created to your instance of Drop-in.
dropInConfiguration.applePay = applePayConfiguration
Optional configuration
If your integration uses iOS Drop-in v5.0.0 or later, you can optionally include the following when you configure the Drop-in:
| Parameter name | Description |
|---|---|
requiredBillingContactFields | Billing information fields that you require from the shopper to fulfill the order. Refer to Apple Pay documentation for sample values. |
requiredShippingContactFields | Shipping information fields that you require from the shopper to fulfill the order. Refer to Apple Pay documentation for sample values. |
billingContact | A prefilled billing address. |
shippingContact | A prefilled shipping address. |
allowOnboarding | Set to true to let the shopper add new cards to their Apple Pay wallet if there are none or if their cards are not supported for the payment. By default this is set to false, and Apple Pay isn’t shown as an available payment method if there are no cards in their Apple Pay wallet. |
shippingType | The type of shipping displayed, for example Pick Up, Ship To, or Deliver To. This is localized. Default: PKShippingTypeShipping = .shipping. |
allowShippingContact | Set to false to prevent the shopper from changing the shipping contact field before showing the payment form. Default: true. |
shippingMethods | An array of supported shipping methods. |
applicationData | Additional information that you provide about the payment request. For example, an order number or cart identifier. This is signed and included in the resulting PKPaymentToken. |
supportedCountries | Only allow payments from cards issued in specific countries. This is a list of ISO 3166 country codes. |
supportsCouponCode | Set to true to let the shopper enter a coupon code which gets validated. Default: false. |
couponCode | A coupon code that has already been applied to the payment request. |
PKRecurringPaymentRequest | Required for recurring payments. Include PKRecurringPaymentRequest to specify that the payment is a recurring payment. |
If your integration uses Drop-in v4.x.x, there’s no additional optional configuration.
Recurring payments
To enable recurring payments, you must includePKRecurringPaymentRequest when configuring Apple Pay.To make recurring Apple Pay payments, you have to create a token and then make subsequent recurring transactions with the token.