> ## Documentation Index
> Fetch the complete documentation index at: https://adyen-preview.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate to 5.9.x

> Migrate Google Pay to version 5.9.x.

You are not required to migrate, but if you do, then 5.9.0 introduced a simplified integration for Google Pay to make migration easier. This new integration excludes the use of the deprecated `onActivityResult` and includes the Google Pay button. Follow the steps below to migrate from previous 5.x.x versions to 5.9.x:

## Overview

1. Remove deprecated Activity Result code
2. Display Google Pay button
3. Google Pay availability check

## Remove deprecated Activity Result code

Add `AdyenComponentView` to your layout and attach the component to it.

**Add AdyenComponentView**

```bash theme={null}
<com.adyen.checkout.ui.core.AdyenComponentView
android:id="@+id/componentView"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
```

**Attach the component to the view**

```bash theme={null}
// Attach the component to the view
binding.componentView.attach(googlePayComponent, lifecycleOwner)

// Or if you use Jetpack Compose
AdyenComponent(googlePayComponent)
```

Now you no longer need activity result related code, so you can clean it up. For example you can remove:

**Remove**

```bash theme={null}
// This function can be deleted
override fun onActivityResult(requestCode: Int, resultCode: Int, data: Intent?) {
super.onActivityResult(requestCode, resultCode, data)
googlePayComponent.handleActivityResult(resultCode, data)
}
```

## Display Google Pay button

If you want to keep displaying a button yourself, then you have to replace the call to `googlePayComponent.startGooglePayScreen(…)` with `googlePayComponent.submit()`.

To let the component display the Google Pay button inside the `AdyenComponentView` remove your own button and adjust your configuration:

**Add a configuration object**

```bash theme={null}
CheckoutConfiguration(
environment = environment,
clientKey = clientKey,
…
) {
   googlePay {
   setSubmitButtonVisible(true)
   setGooglePayButtonStyling(…) // Optionally style the button
  }
}
```

The `com.google.pay.button:compose-pay-button` dependency can now also be removed from your `build.gradle`.

## Google Pay availability check

You no longer need to call `GooglePayComponent.PROVIDER.isAvailable(…)`.

The `GooglePayComponent` now checks if Google Pay is available when you initialize it. If Google Pay is not available, you get a `GooglePayUnavailableException` in `onError`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.