stripe-react-native icon indicating copy to clipboard operation
stripe-react-native copied to clipboard

[Android] 3DSecure confirmation screen closed if app is put in background

Open konstantinmv opened this issue 4 years ago • 19 comments

Hi all. We currently have a bug happening on Android only. After using confirmPaymentMethod on a payment, the 3DS screen is brought up. If instead of confirming / denying the payment on this screen we go into background and then bring the app back to active again, 3DS screen is just dismissed, so the app is stuck. Obviously, at that moment Stripe payment is pending, but there's no way to bring up the payment screen again. Even if there was, then the process would be repeated - if the user has to go to the bank's app in order to confirm the payment or whatever, the problem would come back and always be present.

Note: this does not happen on iOs.

To Reproduce Steps to reproduce the behaviour:

  1. Boot Android React Native app.
  2. Confirm payment with a 3DS card.
  3. When the hooks.stripe.com screen with the confirmation gets brought up, go into background.
  4. Wait 2 seconds, open the app again.
  5. There you have a problem.

Expected behavior The expected behaviour would be the same as in iOs, for this screen not to be dismissed until the user does some action upon it.

Desktop (please complete the following information): OS: MacOs Big Sur 11.2.3 Browser: Chrome Version: 91.0.4472.77 (Official Build) (x86_64)

Smartphone (please complete the following information): Device: Honor 9 Lite Android version: 9

Additional context Stripe version: 0.1.4 React native version: 0.63.4

Thanks in advance!

konstantinmv avatar Jun 18 '21 15:06 konstantinmv

@michelleb-stripe can you look into this?

thorsten-stripe avatar Jun 24 '21 06:06 thorsten-stripe

React Native Android - The previous state of stripe payment screen not getting When app reopens click of app icon after minimize. when I am performing 3d secure payment using stripe payment screen.When I minimize the application in between this process and, reopen it by clicking on the app icon at that time I am not getting the previous state of stripe payment screen specific for android.

vipu-sa avatar Jun 25 '21 07:06 vipu-sa

We are facing the same issue. By when we can expect this issue to be resolved? We are having a major bug because of this.

aanalmehta-sa avatar Jun 25 '21 09:06 aanalmehta-sa

@aanalmehta-sa and @vipu-sa and @konstantinmv

In your manifest file you will have a single activity that has an intent filter of category: android.intent.category.LAUNCHER similar to:

      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
        android:launchMode="singleTask"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>

Can you post the launchMode set on this activity? I believe this might be an issue with a launchMode = singleTask. If you use the defaultLaunch mode it might work. (See related issue: https://github.com/stripe/stripe-android/issues/3290).

michelleb-stripe avatar Jul 13 '21 14:07 michelleb-stripe

closing due to inactivity, @aanalmehta-sa @vipu-sa @konstantinmv please reopen if above solution didn't work for you

arekkubaczkowski avatar Jul 26 '21 08:07 arekkubaczkowski

closing due to inactivity, @aanalmehta-sa @vipu-sa @konstantinmv please reopen if above solution didn't work for you

@arekkubaczkowski I want to draw attention to https://github.com/stripe/stripe-android/issues/3290 also being closed pointing here, while the issue is still real for users like myself. Please reconsider reopening again.

Can you post the launchMode set on this activity? I believe this might be an issue with a launchMode = singleTask. If you use the defaultLaunch mode it might work. (See related issue: stripe/stripe-android#3290).

@michelleb-stripe I have this issue and I am using launchMode="singleTask". My current React Native app will not work if I change my launchMode, I am unable to use defaultLaunch. Can I provide you with some more information to help you debug this?

cristeahub avatar Aug 09 '21 13:08 cristeahub

I'm having the same issue.

To recreate:

  • Initiate payment
  • Leave the app to check for a 3D secure SMS.
  • Re-open the app by clicking on the app icon on the home screen

The payment errors out with "Failed to retrieve a PaymentSheetResult".

However, if you instead resume the app from the Android Task Switcher everything works as expected.

My manifest looks like:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenSize|uiMode"
    android:launchMode="singleTask"
    android:windowSoftInputMode="adjustResize">
    
    <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
    </intent-filter>

    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="myapp" />
    </intent-filter>	
</activity>

I believe you're right that changing the singleTask launch mode will fix but this breaks deep linking for our RN Android app.

Would there be another work around?

aaronSig avatar Aug 12 '21 17:08 aaronSig

Also facing this issue on Android only (same reproduction as @aaronSig), with the following environment :

  • expo: 42.0.0
  • react-native: 0.63.4
  • @stripe/stripe-react-native: 0.1.4

However, resuming the app with the task switcher working as expected (tested in expo go and standalone build).

bob-user avatar Oct 11 '21 08:10 bob-user

@arekkubaczkowski @michelleb-stripe is there anything new about this issue ?

bob-user avatar Oct 18 '21 16:10 bob-user

@bob-user and @konstantinmv @aaronsig @cristeahub

3DS has a challenge response, so there is no way for us to re-create the webview as it would re-trigger the challenge, the user would reopen the banking app, and have the same problem. As long as the activity with the webview still exists in somewhere in the task stack it should be possible to reopen it.

When you relaunch your app in this way, is onNewIntent being called or is it creating a new instance?

michelleb-stripe avatar Oct 19 '21 13:10 michelleb-stripe

@bob-user and @konstantinmv @aaronSig @cristeahub

In order for this to work I believe the StripeBrowserLauncherActivity (in the case of 3DS1) needs to be somewhere on the task stack after the launcher is pressed. However, when I created an application with the launchMode set to "singleTask" the StripeBrowserLauncherActivity is destroyed when clicking the launcher. (I verified this by registering an ActivityLifecycleCallbacks in an Application.onCreate method and logging all lifecycle events).

If you can instead use singleTop, and in the onNewIntent method you can check if it is a deep link and do any work you need there?

michelleb-stripe avatar Oct 20 '21 16:10 michelleb-stripe

@michelleb-stripe I'm using the library in a managed expo app and I'm having trouble ejecting to access native code in order to test. Moreover, I'd like to keep up with the managed workflow so ejecting would only be a matter of debugging in my case. May this be resolved in an other way than accessing native code ?

bob-user avatar Oct 21 '21 06:10 bob-user

Same problem with the following config :

  • expo: 43.0.0
  • react-native: 0.64.2
  • @stripe/stripe-react-native: 0.2.2

shouldn't this issue be reopened ?

bob-user avatar Oct 22 '21 13:10 bob-user

Same problem here with the following config (managed flow expo app):

  • expo: 42.0.3
  • react-native: 0.63.4
  • @stripe/stripe-react-native: 0.1.4

Do you have any eta to solve this issue?

RubenGuerrero avatar Oct 23 '21 11:10 RubenGuerrero

@acomley-stripe @trag-stripe Can you help engage with the expo team on this particular issue? I am happy to help jump in a conversation if needed.

michelleb-stripe avatar Oct 29 '21 20:10 michelleb-stripe

I am experiencing same issue. If launchMode is not singleTask resuming app from app icon works. However we can not use other launch mode with react-native because it might introduce other issues. Also when returning back to the app from the app switcher works, but if app is resumed from the app icon the 3Ds confirmation view is no more.

I have implemented launchMode="singleTop" for now and it seems that this launchMode does resolve the bug. So far I did not notice that this launchMode would impact my app in any negative way. In the long run I think the issue should be resolved on singleTask mode as well

tautvilas avatar Dec 14 '21 13:12 tautvilas

Same issue here. 3DS process is killed when we resume app from home with appIcon ... Any solution ?

MagicMirouff avatar Feb 03 '22 10:02 MagicMirouff

Is there any update on this bug? Its causing a lot of issue for customers

cfeeney5 avatar Mar 27 '22 18:03 cfeeney5

any update ?

Djauron avatar Jun 23 '22 08:06 Djauron

Looking into this, looks like an issue with the underlying android SDK, but could be wrong

charliecruzan-stripe avatar Sep 29 '22 22:09 charliecruzan-stripe

Same issue here with the following steps:

  • Add a payment method
  • Goes to the bank app to authenticate and confirm
  • Goes back to my app
    • Goes back to my app by clicking on the app icon -> fails (and sometimes even no error is returned)
    • Goes back to my app by using the app switcher -> works

AlixH avatar Nov 07 '22 13:11 AlixH

Is there any update on this bug? We are facing the same issue for android users.

viraj-nikam avatar Nov 30 '22 18:11 viraj-nikam

Same problem here on Android with the following config (managed flow expo app):

expo: 46.0.17 react-native: 0.69.6 @stripe/stripe-react-native: 0.13.1

ottob avatar Jan 02 '23 14:01 ottob

Same issue with presentPaymentSheet

nicolasdevienne avatar Jan 04 '23 14:01 nicolasdevienne

Hi, are you making any progress on this?

ottob avatar Mar 03 '23 11:03 ottob

The native version of the 3DS2 auth screen is on the roadmap and is the long term fix for this issue, but we're still looking into proper workarounds in the meantime

charliecruzan-stripe avatar Mar 03 '23 17:03 charliecruzan-stripe

Hi @charliecruzan-stripe, any news regarding this issue ? It has always been there for 2 years and no solution is provided.

This is an issue affecting the 3DS confirmation on Android and causes unintended cases about payment, it's a bit annoying.

A workaround would be appreciable in next release until we get a real fix.

huextrat avatar Apr 05 '23 09:04 huextrat

Unfortunately we're still waiting on a fix in the stripe-android repo, I agree that this is pretty annoying and has been for a while. Let me check and see what the status of this fix is

charliecruzan-stripe avatar Apr 05 '23 22:04 charliecruzan-stripe

Friendly ping :)

ottob avatar Apr 19 '23 07:04 ottob

@charliecruzan-stripe any news ? (Can you give us the issue on stripe-android, thanks )

tgensol avatar May 04 '23 08:05 tgensol