To be able to use Android Components 4.0.0, make sure your integration supports the changes described on this page.
Checkout API version
While Android Components 4.0.0 is backwards compatible with older Checkout API versions, we recommend that you use Checkout API v67 or later.
General
- Drop-in and Components require that you provide a client key in the
Configuration.Builderconstructor. - We migrated from the Android Support Library to AndroidX.
- The minimum supported Android API version is now 21.
- We moved our library from jCenter to Maven Central.
Packages
- Replace
com.adyen.checkout.baseimports withcom.adyen.checkout.components. - Replace
com.adyen.checkout.base.componentimports withcom.adyen.checkout.components.base.
Drop-in
Configuration
Remove the resultIntent parameter from the DropInConfiguration.Builder constructor. You can either remove it completely, or pass it to the DropIn.startPayment method instead.
Handling the result of the Drop-in depends on whether you specified a resultIntent when calling DropIn.startPayment:
Service
- Remove the
android.permission.BIND_JOB_SERVICEfrom theAndroidManifest.xmlentry ofDropInService, since it is now a regular boundServiceinstead of aJobIntentService. - The
SimplifiedDropInServicehas been removed. We recommend that you extend theDropInServiceinstead, and that you only pass theactionobject to the app, not the whole API response. -
Replace
CallResultwith theDropInServiceResultsealed class:Removed Use instead CallResult(CallResult.ResultType.FINISHED, result)DropInServiceResult.Finished(result)CallResult(CallResult.ResultType.ACTION, actionJSON)DropInServiceResult.Action(actionJSON)CallResult(CallResult.ResultType.ERROR, reason)DropInServiceResult.Error(reason = reason)CallResult(CallResult.ResultType.ERROR_WITH_MESSAGE, errorMessage)DropInServiceResult.Error(reason = reason, errorMessage = errorMessage)CallResult(CallResult.ResultType.ERROR_WITH_MESSAGE, errorMessage, dismissDropIn = true)DropInServiceResult.Error(reason = reason, errorMessage = errorMessage, dismissDropIn = true)CallResult(CallResult.ResultType.WAIT, result)Replaced by Asynchronous handling.
Asynchronous handling
- Remove
makePaymentsCallandmakeDetailsCall, and overrideonPaymentsCallRequestedandonDetailsCallRequestedinstead. - Remove any
CallResult.ResultType.WAIToccurrences andasyncCallbackcalls. - Call the
sendResultmethod to perform an asynchronous callback. - Make sure to manage the threads manually in
onPaymentsCallRequestedandonDetailsCallRequested. UnlikemakePaymentsCallandmakeDetailsCall, these methods run on the main thread by default.
override fun onPaymentsCallRequested(paymentComponentState: PaymentComponentState<*>, paymentComponentJson: JSONObject) {
launch(Dispatchers.IO) {
// Send the data to your server.
val response = sendPaymentsRequest(paymentComponentJson)
}
}
// This should be wherever you get the response back from your server.
fun handleYourPaymentsResponse(response: YourResponse) {
// Parse the response, extract the corresponding DropInServiceResult and return it.
val result: DropInServiceResult = handleResponse(response)
// Replaces the asyncCallback method.
sendResult(result)
}
override fun onDetailsCallRequested(actionComponentData: ActionComponentData, actionComponentJson: JSONObject) {
launch(Dispatchers.IO) {
// Send the data to your server.
val response = sendPaymentsDetailsRequest(actionComponentJson)
}
}
// This should be wherever you get the response back from your server.
fun handleYourPaymentsDetailsResponse(response: YourResponse) {
// Parse the response, extract the corresponding DropInServiceResult and return it.
val result: DropInServiceResult = handleResponse(response)
// Replaces the asyncCallback method.
sendResult(result)
}
You can also check the ExampleAsyncDropInService for an example implementation.
Components
- Fix your module imports: each payment method has only one module now. The
card-baseandcard-uimodules have been merged into a singlecardmodule, and similarly for other payment methods. - Provide a configuration for any Action Component Provider that you are using.
- Make note of the
isReadyflag inComponentState: some components (likeCardComponent) might require some initialization time even if all the inputs are valid. TheisValidflag is still only valid if both the UI is valid and the component is initialized and ready. Use theisInputValidflag if you only want to check if the UI is valid. - By default, payment component providers do not have the
isAvailablemethod, and you can treat them as always available. Only providers for payment methods that require an availability check (currently Google Pay and WeChat Pay) have theisAvailablemethod.
Card
In CardConfiguration.Builder:
- Replace
setHolderNameRequirewithsetHolderNameRequired. - Replace the
publicKeywith yourclientKey.Because
publicKeyandclientKeyare both strings, not making this change will not result in an error in your IDE. The issue will only be picked up during runtime validation.
3D Secure
- The
Adyen3DS2Componentsupports the new 3D Secure 2 flow introduced in Checkout API v67. The old flow is still supported if you are using an API version earlier than 67. - Use the
Adyen3DS2Component.handleIntentmethod to handle 3D Secure redirects. When the 3D Secure 2 redirect response is returned to your app, callthreedsComponent.handleIntentand pass the receivedintentin the parameters. The component will then notify your observer (fromthreedsComponent.observe) with the data that you need to pass to your server.
Redirect
- Replace
handleRedirectResponsewithhandleIntentinRedirectComponent.
Bancontact
- In
BcmcConfiguration.Builder, replace thepublicKeywith yourclientKey.Because
publicKeyandclientKeyare both strings, not making this change will not result in an error in your IDE. The issue will only be picked up during runtime validation. - For Bancontact mobile, if you were using a workaround to replace the
bcmc_mobilepayment method type withbcmc_mobile_app, remove the workaround and handle the action with the QR Code Component.
QR Code
- Use the
QRCodeComponentto handle actions with aqrCodetype (for example Bancontact mobile, Swish, and Pix). - Use the
QRCodeComponent.PROVIDER.canHandleActionto check whether this component can handle the action you received. - Use the
QRCodeComponent.PROVIDER.requiresViewto check whether a view is required:- Some payment methods (currently only Pix) will require a view to be shown. Use
QRCodeViewandattachit to the component. - Other payment methods (for example Bancontact mobile) only work as a redirect.
- Some payment methods (currently only Pix) will require a view to be shown. Use
Google Pay
- You can remove
com.google.android.gms:play-services-walletfrom yourbuild.gradlefile. We added the Google Pay SDK dependency asapi, so it is also available