braintree / braintree_android

Braintree SDK for Android
https://developer.paypal.com/braintree/docs/start/hello-client/android/v4
MIT License
409 stars 234 forks source link

BrainTree BrowserSwitchActivity stills opened after success payment #201

Closed alcaamado closed 6 years ago

alcaamado commented 6 years ago

General information

Issue description

We are implementing braintree to perform PayPal payments in an Android app. Following the documentation, we became able to make payments, but we faced a problem that we couldn't resolve. When we call to "PayPal.requestOneTimePayment", a browser appears and we can finish the payment successfully, but when the flow return to the app, the brower stills opened in background.

There is a way to close that browser so the user cannot return to it?

Thanks in advance.

lucabaggi commented 6 years ago

Hi all, I'm facing the same issue (I came here to create a ticket and saw it was just created). Not only on confirm, in my case browser stills open in background when user presses the cancel button.

Thanks in advance for support

quinnjn commented 6 years ago

This issue is more related to https://github.com/braintree/browser-switch-android but I can answer here.

First off we can't programmatically close the browser/tab so that doesn't leave us with a lot of options.

Android Browser Switch used to have the FLAG_ACTIVITY_NO_HISTORY so that when the user navigated away from the browser/tab it would close for us.

This caused problems with users that use password managers navigating away to grab their credentials. They wouldn't be able to navigate back since the tab had closed. Here is the commit explaining the problem: https://github.com/braintree/browser-switch-android/commit/3d4d950de82b6524b4d5fdc5a70790a38955a0a4

It is unfortunate that we have to leave the browser in a non-closed state but it felt like the better choice than blocking password manager users. We're keeping an eye open for an improved flow in the future.

quinnjn commented 6 years ago

Going to close this issue. Feel free to continue commenting if you have more questions on this topic.

ddnn55 commented 5 years ago

Is it possible to open the PayPal browser stuff in an embedded WebView inside the app? Then we can surely close it when done..?

ddnn55 commented 5 years ago

I'm very very new to Android, but leaving a PayPal window open seems terribly messy and like nothing I've seen in the wild. Again, I've only used iOS until, like, today :D

quinnjn commented 5 years ago

Hi @gimlids,

If you're already an iOS developer you probably know that WebView's are not secure. WebView's cannot be trusted for entering credentials, and I wouldn't want to put users at that security risk. Also, PayPal does not want applications showing PayPal pages in a WebView.

There is an open issue on this repository where we've started to make some progress by asking the Chromium team to give Chrome Custom Tabs an API to close tabs.

If you can't view this open issue here is a link to the Chromium feature request. I'd recommend leaving a comment there so that we can get more attraction with the feature request, and solve your issue!

If you have any more suggestions, please comment on that open braintree_android issue instead of this old closed one.

Meera18 commented 3 years ago

Does anyone got any solution on this? Because I am still facing browser open issue. And it fails second payment if browser is still open with previous paypal window.

sshropshire commented 3 years ago

Hi @Meera18 thanks for using the Braintree SDK for Android. I would suggest trying out our new beta version to see if the issue persists.

Meera18 commented 3 years ago

@sshropshire Thank you for the reply. But I am implementing braintree in xamarin.forms and using latest Naxam.Braintree.Droid libraries. Still getting issue.