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.

Paypal browser switch works only api 28+ (including 28)

See original GitHub issue

General information

  • SDK/Library version: 4.2.0/4.6.0
  • Environment: Sandbox and Production
  • Android Version and Device: Android API 26, 27 are not working, from 28 works fine
  • Braintree dependencies:
  • com.braintreepayments.api:paypal:4.2.0/4.6.0
  • com.braintreepayments.api:data-collector:4.2.0/4.6.0

Bug description

We are using the braintree-api to support PayPal payment, and in Fragment we have called the method to waiting for the nonce like this way.

    override fun onResume() {
        super.onResume()

        braintreeClient?.deliverBrowserSwitchResult(activity)?.let { result ->
            if (result.requestCode == BraintreeRequestCodes.PAYPAL) {
                payPalClient?.onBrowserSwitchResult(result) { nonce, error ->
               // send nonce to server
                }
            }
        }
    }

also in activity we have called setIntent(intent) in onNewIntent.

In the case api 28+, if we open the PayPal-WebVie, after the user is authorized and the WebView is closed , the method onResume from Fragment is called, and we can receive the nonce from callback.

But in api 26 and 27, we can’t receive any nonce after user is authorized. Because the activity is newly started, the onNewIntent is not called, and the Fragment is disappeared, the onResume not called.

Actually the problem might be the onNewIntent method was not called.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:16 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
F9F8commented, Nov 25, 2021

@sarahkoop I have found another problem, if you change the default browser from chrome to firefox or opera, it has the same problem as above what i mentioned, although i used android 10 and 11. You could try to use my test app.

1reaction
F9F8commented, Oct 20, 2021

@sarahkoop Thank you for the answer and the investigation, unfortunately this solution won’t help us, because the fragment is deeply integrated, which call the PayPal-Api, it’s not that simple as “FragmentOne” and “FragmentTwo”, and also very difficult to rebinding the data for each fragment.

I can also understand, if Google has a similar problem, it will be difficult to fix it. We are going to show a dialog for the customer, that paypal is currently not support by android 7 and 8.

Thanks again for your support, i really like your api.

Read more comments on GitHub >

github_iconTop Results From Across the Web

BrowserSwitchResult receiving UserCanceledException #409
I think I have hit one case that is not handled by the SDK. Steps: Implement PayPal flow according to docs; While in...
Read more >
Paypal Button & Credit Card Field not showing on mobile only
The paypal button not showing while using paypal output – The credit card field not showing. I tried using different browsers and it...
Read more >
Troubleshoot common errors in the WooCommerce PayPal ...
Listed below are some of the most commonly occurring error codes with their possible reasons/solutions. The following article is intended for ...
Read more >
Paypal down? Check current status - Downdetector
Real-time status for Paypal. Is the website down, can't check your statements or log in? We'll tell you what is going on.
Read more >
Android Braintree, Paypal not working, Rejecting re-init on ...
braintreepayments.api.BraintreeFragment$15>: java.lang.NoClassDefFoundError: Failed resolution of: Lcom/google/android/gms/common/api/ ...
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