question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

BrowserSwitchResult receiving UserCanceledException

See original GitHub issue

General information

  • SDK/Library version: 4.0.1
  • Environment: Sandbox but should behave the same in prod
  • Android Version and Device: Android 10, 11, Pixel 3, Pixel 4 com.braintreepayments.api:data-collector com.braintreepayments.api:paypal

Issue description

I migrated from SDK version 3 to 4 and implemented PayPal flow according to your documentation.

I think I have hit one case that is not handled by the SDK. Steps:

  1. Implement PayPal flow according to docs
  2. While in in the PayPal flow (BrowserSwithch / Chromium custom tabs) click under the three dots on top right
  3. Select open in Chrome

What happens is that immediately when the new Chrome process is started I receive in my PayPalActivity (identical to your docs example) callback from payPalClient.onBrowserSwitchResult which is placed in the onResume() of the activity. The callback receives UserCanceledException which I handle as the user cancelled the flow (exiting the activity and not receiving the payPalAccountNonce). This means that the flow does not work if user opens the custom tab in new Chrome process.

Do you have ideas how we could make this work?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
martinrehdercommented, Apr 10, 2022

Has the UserCanceledException issue for Paypal been resolved? I’ve noticed that when the exception occurs, I can tap the ‘Overview’ button on the phone and see there is still a paypal activity on the stack , still spinning its progress indicator. In fact, there’s an activity still running for the last several attempts I’ve made to use PayPal. Seems like the webview is not finishing before going back to the app to complete the purchase and therefore shows as canceled. I’ve attached a short video showing the paypal activities still running

https://user-images.githubusercontent.com/90287915/162626833-f2304c27-5c71-4d97-a584-e753c99ea8b3.mp4

0reactions
mikkovillecommented, May 30, 2022

@sshropshire I have re opened this again since it seems to still happen quite a lot for our users: https://github.com/braintree/braintree_android/issues/557

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - BrowserSwitchResult receiving UserCanceledException
The callback receives UserCanceledException which I handle as the user cancelled the flow (exiting the activity and not receiving the payPalAccountNonce ).
Read more >
Migration | Android - Braintree Developer Documentation
When the customer cancels out of a payment flow, a UserCanceledException will be returned in the on<PaymentMethod>Failure listener method. Handling Errors.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found