braintree / braintree-android-drop-in

Braintree Drop-In SDK for Android
https://developers.braintreepayments.com/guides/drop-in/android/v2
MIT License
124 stars 79 forks source link

How to recover for app crash during browser PayPal setup flow? #230

Closed samzmann closed 3 years ago

samzmann commented 3 years ago

General information

Issue description

In some cases the app crashes unexpectedly while the user is midway through the PayPal setup flow in the browser app. This is probably not a bug in this library. It happens sporadically, mostly on low end devices. Only on Android. It becomes a problem when the setup completes and the user is sent back to the app: the app context is gone and we cannot handle PayPal success correctly (eg. send the nonce to our backend). I have a React Native app and as mentioned above, I am using react-native-braintree-dropin-ui. That library is essentially a wrapper around braintree-android-drop-in so I think it's still relevant to post the issue here.

So my questions are:

Thanks!

scannillo commented 3 years ago

Hi @LaVielle thanks for opening this issue.

Our SDK supports Android 21+, so we aren't going to provide fixes / support for issues on devices running Android 10. For that reason, I am going to close this issue. Please see our Client SDK Deprecation policy to read about our supported versions.

is there a way to recover from such an app crash during the browser setup flow?

I don't know enough about where exactly your application is crashing in order to provide tips on how to safeguard for it. We would need more specifics on where in the braintree_android implementation you are able to replicate this crash.

is there a way to store the nonce in some sort of local storage (eg. Shared Preferences) when the browser flow succeeds, and to retrieve it on app start?

Since nonces do expire in 3 hours, I don't think this is ideal. You could do something like this on your own, but it will likely confuse a user if their app crashes during checkout but you continue on to transact with their nonce.

is there a way to configure a success deeplink that is opened when the browser flow succeeds (eg. https://myapp.co/?braintrenonce=xxxxxx), in which case my app could handle the deeplink no matter whether it's in background or quit state.

For our checkout flows that utilize a browser switch (such as PayPal) you must define a URL scheme. See docs.