Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Users getting UserCanceledException on PayPal CustomTabs tokenization after minimizing the CustomTabs #953

Open
LAMESGIT opened this issue Mar 22, 2024 · 4 comments

Comments

@LAMESGIT
Copy link

Braintree SDK Version

4.33.0

Environment

Both

Android Version & Device

Google Pixel 4 - Android 13.0

Braintree dependencies

implementation 'com.braintreepayments.api:paypal:4.33.0'

Describe the bug

Hi,
We have a feedback from one of our testers that the authorization in paypal webpage using Chrome CustomTabs cancels once he clicks the "minimize" button on the CustomTabs toolbar.
We analyze the log and find Braintree returns "UserCanceledException: User canceled PayPal" from onPayPalFailure method.

To reproduce

  1. Install Chrome of which version at least 122 on the phone, and set it as the CustomTabs provider.
  2. Choose PayPal as the payment method and checkout (i.e. invoke PayPalClient.tokenizePayPalAccount method).
  3. Some users can see screen like this below:
    Screenshot_20240322-170944
  4. On the right of close button, there is a down arrow. Click it and the customTabs will be minimized, after that onPayPalFailure is called.

If you can't see the minimize button on CustomTabs toolbar, make sure the brand of the test phone is NOT Xiaomi. And if you still can't see the button, open chrome and open uri: chrome://flags/#cct-minimized, set the flag to ENABLED and check again.

Expected behavior

We don't wanna receive this UserCanceledException when minimize the customTabs. We hope the calling process can be waiting while the customTabs is minimized and receive token result after customTabs is truly cancelled.
Also we did some analysis of the code logic, we think the minimization feature enabled by Chrome is the reason (may be wrong :) ), according to this doc about the overview of Android customTabs: https://developer.chrome.com/docs/android/custom-tabs. This feature is based on Picture-in-Picture in Android system. Once the customTabs is minimized, the checkout page would be resumed, and the PayPalLifecycleObserver would get ON_RESUME lifecycle event, which triggers the SDK flow.

Have a nice day~ :)

Screenshots

No response

@sarahkoop
Copy link
Contributor

Hi @LAMESGIT - Thank you for reporting this issue. We are currently investigating this behavior and will post here when we have an update!

@LAMESGIT
Copy link
Author

@sarahkoop Thanks a lot! It would be a great help to us. 😊

@tdchow
Copy link
Collaborator

tdchow commented Oct 1, 2024

Hi @LAMESGIT - We just released the GA version of v5! In this version, the interface has been updated to give the additional browser switch flexibility.

For the case where the user minimizes the Chrome Custom Tab and returns to the app, the callback will return NoResult. You can then handle this however you need. The buyer can still return to the Chrome Custom Tab to complete the payment flow.

Please give v5 a try and let us know if you run into any issues!

Releases: https://github.com/braintree/braintree_android/releases/tag/5.0.0
v5 Migration Guide: https://github.com/braintree/braintree_android/blob/main/v5_MIGRATION_GUIDE.md

@LAMESGIT
Copy link
Author

LAMESGIT commented Oct 7, 2024

Hi @LAMESGIT - We just released the GA version of v5! In this version, the interface has been updated to give the additional browser switch flexibility.

For the case where the user minimizes the Chrome Custom Tab and returns to the app, the callback will return NoResult. You can then handle this however you need. The buyer can still return to the Chrome Custom Tab to complete the payment flow.

Please give v5 a try and let us know if you run into any issues!

Releases: https://github.com/braintree/braintree_android/releases/tag/5.0.0 v5 Migration Guide: https://github.com/braintree/braintree_android/blob/main/v5_MIGRATION_GUIDE.md

SOUNDS GREAT! We'll look into this v5 version upgrade. It may take some time for us to estimate the work and risk of this upgrade.
Thank you guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants