adyen-android: Failed to initialize Drop-in

Describe the bug Crash is happening when retuning to our app most probably after processing 3DS on bank/browser app Version 4.4.0

To Reproduce Exact steps are unknown

Smartphone (please complete the following information):

  • Device: Alcatel 3L and Xiaomi POCO X3 Pro
  • OS: Android 8.1.0 and Android 11

Additional context We start DropIn flow by DropIn.startPayment(fragment, launcher, paymentMethodsApiResponse, dropInConfiguration)

result:

Fatal Exception: java.lang.RuntimeException: Unable to start activity 
Caused by kf.c: Failed to initialize Drop-in, did you manually launch DropInActivity?
       at com.adyen.checkout.dropin.ui.DropInViewModel.getStateValueOrFail(DropInViewModel.kt:119)
       at com.adyen.checkout.dropin.ui.DropInViewModel.<init>(DropInViewModel.kt:64)
       at com.adyen.checkout.dropin.ui.DropInViewModelFactory.create(DropInViewModelFactory.kt:24)
       at androidx.lifecycle.AbstractSavedStateViewModelFactory.create(AbstractSavedStateViewModelFactory.java:69)
       at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:169)
       at androidx.lifecycle.ViewModelProvider.get(ViewModelProvider.java:139)
       at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:44)
       at androidx.lifecycle.ViewModelLazy.getValue(ViewModelLazy.kt:31)
       at com.adyen.checkout.dropin.ui.DropInActivity.<clinit>(DropInActivity.kt:89)
       at com.adyen.checkout.dropin.ui.DropInActivity.onCreate(DropInActivity.kt:176)

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Comments: 31 (4 by maintainers)

Most upvoted comments

For the moment we will gracefully handle this issue by suppressing the crash and logging an error, this will roll out in the next release 4.8.0.

As mentioned earlier, so far we thought of 2 ways this issue could happen:

  • After the redirect happens, the user decides to manually kill the app, then goes back to the browser and completes the payment, with the condition that the redirect is not launched in custom tabs but in an external browser. This scenario should not be common at all and we consider it an edge case.
  • After the payment is finished, the payment page is still in the browser and did not close (for whatever reason) and the user went back and confirmed the payment again, in this case gracefully ignoring the redirect is the better approach to avoid double payments.

In all cases it is very tricky to deal with this issue as we have no way of retrieving any of the previous state that drop-in was in, when the redirect was launched. We are looking into multiple solutions, none of which are simple or straightforward, so we don’t expect this issue to have a full solution any time soon. Sorry for the inconvenience, we’ll make sure to update this ticket once we have anything new.

Thank you for reaching out! This has most likely been fixed in version 4.5.0 of the SDK. Could you try updating it?

The latest exception you shared might mean that this issue is not directly related to the SDK so we’ll need more information related to the failing payments, but unfortunately we cannot ask for this info on github.

Can you please reach out to our support team? They should be able to help you troubleshoot this better.

@jreij Thank you, i was able to actually just add the same android:taskAffinity to the DropInActivity in my manifest and now it seems to be working.

@jreij it doesn’t always require the user to open it in Chrome; for example it happens if the user has Firefox set as their default browser.

We do plan to fix this, but I don’t think the fix will be released on the short term. I’ll update this issue once I know more