--- title: "Upgrade to Adyen Android v5" description: "Find out more about the breaking changes in this release." url: "https://docs.adyen.com/online-payments/upgrade-your-integration/upgrade-to-android-5-0-0" source_url: "https://docs.adyen.com/online-payments/upgrade-your-integration/upgrade-to-android-5-0-0.md" canonical: "https://docs.adyen.com/online-payments/upgrade-your-integration/upgrade-to-android-5-0-0" last_modified: "2023-11-30T12:37:00+01:00" language: "en" --- # Upgrade to Adyen Android v5 Find out more about the breaking changes in this release. If your integration uses Android v4.13.3 and earlier, and you are upgrading it to use v5.0.0, make the following changes to your integration. ## Checkout API version We recommend using [Checkout API v70](/online-payments/release-notes?integration_type=api\&version=70). ## Step 1: Upgrade versions of build configuration and dependencies Build configuration: [`compileSdkVersion` and `targetSdkVersion`](https://developer.android.com/about/versions/11/setup-sdk#update-build): **34**.\ Dependencies: | Name | Version | | ----------------------------------------------------------------------------------------------------- | -------------- | | [Adyen 3DS2](https://github.com/Adyen/adyen-3ds2-android) | **2.2.15** | | [Android Gradle plugin](https://developer.android.com/build/releases/gradle-plugin) | **8.1.1** | | [Appcompat](https://developer.android.com/jetpack/androidx/releases/appcompat) | **1.6.1** | | [AndroidX Browser](https://developer.android.com/jetpack/androidx/releases/browser) | **1.6.0** | | [AndroidX Compose Bill of Materials (BOM)](https://developer.android.com/jetpack/compose/bom) | **2023.09.00** | | [AndroidX Compose compiler](https://developer.android.com/jetpack/androidx/releases/compose-compiler) | **1.5.3** | | [AndroidX Fragment](https://developer.android.com/jetpack/androidx/releases/fragment) | **1.6.1** | | [AndroidX Lifecycle](https://developer.android.com/jetpack/androidx/releases/lifecycle) | **2.5.1** | | [AndroidX Recyclerview](https://developer.android.com/jetpack/androidx/releases/recyclerview) | **1.3.1** | | [AndroidX Constraintlayout](https://developer.android.com/jetpack/androidx/releases/constraintlayout) | **2.1.4** | | [Cash App Pay](https://github.com/cashapp/cash-app-pay-android-sdk) | **2.3.0** | | [Google Pay](https://developers.google.com/pay/api/android/support/release-notes) | **19.2.1** | | [Kotlin coroutines](https://kotlinlang.org/docs/coroutines-overview.html) | **1.6.4** | | [Kotlin Gradle plugin](https://plugins.gradle.org/plugin/org.jetbrains.kotlin.android) | **1.9.10** | | [Material Design](https://m2.material.io/) | **1.9.0** | | [WeChat Pay](https://pay.weixin.qq.com/wechatpay_guide/help_docs.shtml) | **6.8.0** | ## Step 2: Upgrade the configuration object In your configuration object, you now must set the following properties: | Property | Required | Description | | --------------- | ------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- | | `amount` | If you want to show the amount on the **Pay** button. | The currency and value of the payment amount shown on the **Pay** button. | | `shopperLocale` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | The shopper's locale. To use the device's default locale, replace this with your context. | | `environment` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Use `Environment.TEST` for testing. When going live, use one of our live environments. | | `clientKey` | ![-white\_check\_mark-](/user/data/smileys/emoji/white_check_mark.png "-white_check_mark-") | Your client key. | ### Tab: Drop-in In v5.3.0, how you [configure Drop-in](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in\&version=5.3.0#configure) changes. For example: **Configuring Drop-in** ```java // Create the amount object. val amount = Amount( currency = "EUR", value = 1000, ) // Create a configuration object. val dropInConfiguration = DropInConfiguration.Builder( shopperLocale, // Use your context instead to use the device's default locale. environment, clientKey ) // Set the amount on the Drop-in. .setAmount(amount) // Optional to show the amount on the Pay button. .build() ``` ### Tab: Components In v5.3.0, how you [configure Components](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components\&version=5.3.0#configure) changes. For example, to configure the card Component: **Configuring the card Component** ```java // Create the amount object. val amount = Amount( currency = "EUR", value = 1000, ) // Create a configuration object. val cardConfiguration = CardConfiguration.Builder( shopperLocale, // Use your context instead to use the device's default locale. environment, clientKey ) // Set the amount in the configuration object. .setAmount(amount) // Optional to show the amount on the Pay button. .setHolderNameRequired(true) // Optional configuration property to show the cardholder name input field. .build() ``` ## Step 3: Upgrade methods ### Tab: Drop-in Remove methods from the **v4.13.3** column and replace them with the ones from the **v5.0.0** column: | v4.13.3 or earlier | v5.0.0 | | ------------------ | --------------------- | | `makePaymentsCall` | `onSubmit` | | `makeDetailsCall` | `onAdditionalDetails` | | `onActivityResult` | Not applicable. | ### Tab: Components 1. Remove the following methods. They can no longer be used. * `observe` * `removeObserver` * `removeObservers` 2. You must now implement a callback interface that you pass to the provider. Implement methods in `ComponentCallback` to pass data between your frontend app and your backend server. | Method | Description | | --------------------- | -------------------------------------------------------------------------------------------------------------- | | `onSubmit` | Make a [/payments](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments) request. | | `onAdditionalDetails` | Make a [/payments/details](https://docs.adyen.com/api-explorer/Checkout/latest/post/payments/details) request. | | `onError` | Handle an error if the Component encounters it. | For example, for the card Component: **Implement methods for the card Component** ```java // Handler to make a /payments request. override fun onSubmit(state: CardComponentState) { val paymentComponentJson = PaymentComponentData.SERIALIZER.serialize(state.data) // Your server makes /payments request, including paymentComponentJson. // If additional action is required, handle the action. val action = Action.SERIALIZER.deserialize(actionJSONObject) cardComponent.handleAction(action, activity) } // Handler to make a /payments/details request to send additional payment details. override fun onAdditionalDetails(actionComponentData: ActionComponentData) { val actionComponentJson = ActionComponentData.SERIALIZER.serialize(actionComponentData) // Your server makes a /payments/details request, including actionComponentJson. } // The Component encounters an error. override fun onError(componentError: ComponentError) { // Handle the error. } ``` ### Upgrade the view You must now use `AdyenComponentView` with all Components. You can no longer use an individual view for each Component. Add `AdyenComponentView` to your layout `.xml` file. For example: ```xml ``` ## Step 4: Upgrade launching ### Tab: Drop-in In v5.3.0, how you [launch Drop-in](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Drop-in\&version=5.3.0#launch-and-show) changes. When you launch Drop-in calling `DropIn.startPayment`, you must now pass: | Parameter | Description | | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------ | | `context` | Your context. | | `dropInLauncher` | The Drop-in launcher you declared in your `Activity` or `Fragment`. | | `paymentMethodsApiResponse` | The [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) response that you deserialized. | | `dropInConfiguration` | The Drop-in configuration that you created. | | `YourDropInService::class.java` (Example) | The `DropInService` that you created. | You can no longer launch Drop-in with a result intent. For example: **Launch Drop-in in v5.0.0** ```java DropIn.startPayment( context, dropInLauncher, paymentMethodsApiResponse, dropInConfiguration, YourDropInService::class.java ) ``` ### Tab: Components In v5.3.0, how you [launch Components](/online-payments/build-your-integration/advanced-flow/?platform=Android\&integration=Components-in\&version=5.3.0#launch-and-show) changes. When you launch the Component calling `PROVIDER.get`, you must now pass: | Parameter | Description | | ---------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- | | `activity` or `fragment` (Example) | Your `Activity` or `Fragment`. | | `paymentMethod` | The payment method from your [/paymentMethods](https://docs.adyen.com/api-explorer/Checkout/latest/post/paymentMethods) response. | | `cardConfiguration` | The card configuration that you created. | | `componentCallback` | The callback for the functions you implemented. | For example: **Launch the Component in v5.0.0** ```java // Create the payment method object from the /paymentMethods response. val paymentMethod = paymentMethodsApiResponse?.paymentMethods.orEmpty().firstOrNull { it.type == PaymentMethodTypes.SCHEME } val cardComponent = CardComponent.PROVIDER.get( activity, // Your activity or fragment. paymentMethod, cardConfiguration, componentCallback, ) ``` ## Step 5: Fix broken imports Some classes are moved in this version. For most classes, the names haven't changed and you only have to re-import them. When importing the classes marked with a name change in the [release notes](/online-payments/release-notes), you must update import statements. Public classes and functions that should not be directly used are marked as internal in this version. If you get a [Restricted API](https://googlesamples.github.io/android-custom-lint-rules/checks/RestrictedApi.md.html) lint error on a class or function, this means it is internal and must not be used.\ If you believe the error you received is incorrect, report it by [opening an issue on our GitHub repo](https://github.com/Adyen/adyen-android/issues/new/choose). ## Step 6 (optional): Upgrade your action handling implementation For Components integrations: In this version, the payment method Components can handle the required actions. For example the card Component can handle the **redirect** and **threeDS2** actions. You do not need to implement the `RedirectComponent` or the `Adyen3DS2Component` to handle redirects or 3D Secure authentication for cards. If you want to handle actions on a different page than the checkout one, you can use the `GenericActionComponent` instead.