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
- Remove deprecated Activity Result code
- Display Google Pay button
- Google Pay availability check
Remove deprecated Activity Result code
Add AdyenComponentView
to your layout and attach the component to it.
Now you no longer need activity result related code, so you can clean it up. For example you can remove:
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:
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
.