--- title: "Apple Pay Drop-in integration" description: "Add Apple Pay to an existing iOS Drop-in integration." url: "https://docs.adyen.com/payment-methods/apple-pay/ios-drop-in" source_url: "https://docs.adyen.com/payment-methods/apple-pay/ios-drop-in.md" canonical: "https://docs.adyen.com/payment-methods/apple-pay/ios-drop-in" last_modified: "2023-02-26T21:23:00+01:00" language: "en" --- # Apple Pay Drop-in integration Add Apple Pay to an existing iOS Drop-in integration. [View source](/payment-methods/apple-pay/ios-drop-in.md) This page explains how to add Apple Pay to your existing iOS Drop-in integration. ## Requirements Select which endpoint you are using: ### Tab: `/sessions` | Requirement | Description | | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built a Sessions flow [iOS Drop-in integration](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in). | | **[API credential roles](/development-resources/api-credentials/roles/)** | To [process live Apple Pay payments](#going-live) 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](/payment-methods/apple-pay/apple-pay-certificate/ios). - [Added Apple Pay in your Customer Area](/payment-methods/apple-pay/apple-pay-certificate/ios#add-apple-pay-as-a-payment-method-ios). | ### Tab: `/payments` | Requirement | Description | | ------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | **Integration type** | Make sure that you have built an Advanced flow [iOS Drop-in integration](/online-payments/build-your-integration/advanced-flow?platform=iOS\&integration=Drop-in). | | **[API credential roles](/development-resources/api-credentials/roles/)** | To [process live Apple Pay payments](#going-live) 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](/payment-methods/apple-pay/apple-pay-certificate/ios). - [Added Apple Pay in your Customer Area](/payment-methods/apple-pay/apple-pay-certificate/ios#add-apple-pay-as-a-payment-method-ios). | ## 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](https://docs.adyen.com/api-explorer/Checkout/latest/post/sessions): This is the default with [Drop-in v5.0.0](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in) or later. * [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments): If you implemented an [additional use case](/online-payments/build-your-integration). If you run into an error, refer to [Handle Apple Pay errors](/payment-methods/apple-pay/handle-apple-pay-errors). ## Drop-in configuration When you [configure Drop-in](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in#configure-drop-in), you need additional configuration for Apple Pay. ### Tab: v5.3.0 or later Include the following when you [configure Drop-in](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in#configure-drop-in): | Parameter name | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `paymentRequest` | Your Apple Pay [PKPaymentRequest](https://developer.apple.com/documentation/passkit/pkpaymentrequest) object. | | `merchantIdentifier` | Your Apple Pay [merchant identifier](/payment-methods/apple-pay/apple-pay-certificate/ios#create-merchant-identifier). | **Create the configuration object** ```swift //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) ``` ### Tab: v5.0.0 to v5.2.0 Include the following when you [configure Drop-in](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in#configure-drop-in): | Parameter name | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `merchantIdentifier` | Your Apple Pay [merchant identifier](/payment-methods/apple-pay/apple-pay-certificate/ios#create-merchant-identifier). | **Create the configuration object** ```swift //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") ``` ### Tab: v4.x.x If your integration uses Drop-in [v4.10.0](/online-payments/release-notes?integration_type=ios\&version=4.10.0) or earlier, include following configuration for Apple Pay: | Parameter name | Description | | -------------------- | ---------------------------------------------------------------------------------------------------------------------- | | `merchantIdentifier` | Your Apple Pay [merchant identifier](/payment-methods/apple-pay/apple-pay-certificate/ios#create-merchant-identifier). | | `payment` | The amount, currency, and country code of the payment. | | `summaryItems` | The items included in the purchase. | **Create the configuration object** ```swift // 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 ### Tab: v5.0.0 or later If your integration uses iOS Drop-in v5.0.0 or later, you can optionally include the following when you [configure the Drop-in](/online-payments/build-your-integration/sessions-flow?platform=iOS\&integration=Drop-in#configure-drop-in): | Parameter name | Description | | -------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | | [`requiredBillingContactFields`](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/2216120-requiredbillingcontactfields) | Billing information fields that you require from the shopper to fulfill the order. Refer to Apple Pay documentation for sample values. | | [`requiredShippingContactFields`](https://developer.apple.com/documentation/apple_pay_on_the_web/applepaypaymentrequest/2216121-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](https://www.iso.org/iso-3166-country-codes.html). | | `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](https://developer.apple.com/documentation/passkit/PKRecurringPaymentRequest) to specify that the payment is a recurring payment. | ### Tab: v4.x.x If your integration uses Drop-in v4.x.x, there's no additional optional configuration. ## Recurring payments To enable recurring payments, you must include `PKRecurringPaymentRequest` [when configuring Apple Pay](#optional-configuration). To make recurring Apple Pay payments, you have to [create a token](/online-payments/tokenization/create-tokens) and then [make subsequent recurring transactions](/online-payments/tokenization/make-token-payments) with the token. ## 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](https://developer.apple.com/apple-pay/sandbox-testing/) on Apple's Developer website. Check the status of an Apple Pay test payment in your [Customer Area](https://ca-test.adyen.com/) > **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](https://ca-live.adyen.com/) or ask your Admin user to verify. [Set up Apple Pay](/payment-methods/apple-pay/apple-pay-certificate/ios) on your Apple Pay Developer account for your live merchant identifier. ## See also * [Web Drop-in integration guide](/online-payments/drop-in-web) * [Tokenization](/online-payments/tokenization) * [Apple Pay error codes](/development-resources/error-codes#apple-pay-error-codes) * [API Explorer](https://docs.adyen.com/api-explorer/#/CheckoutService/latest/overview)