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

Migration paypal v5: PayPalPaymentAuthResult - NoResult #1184

Open
javier-28 opened this issue Oct 9, 2024 · 11 comments
Open

Migration paypal v5: PayPalPaymentAuthResult - NoResult #1184

javier-28 opened this issue Oct 9, 2024 · 11 comments
Assignees

Comments

@javier-28
Copy link

Braintree SDK Version

5.0

Environment

Sandbox

Android Version & Device

Pixel 4 XL API 34

Braintree dependencies

com.braintreepayments.api:paypal

Describe the bug

I am in the process of updating the PayPal library to version 5.0. I am founding the following issue:

The WebView is displayed, and we can authenticate on the PayPal platform. You can select the payment method and press continue.
The deeplink opens, and it redirects back to the app, but the success case is not reached. The result of the method is PayPalPaymentAuthResult.NoResult.

I don't understand why it's always reaching this scenario.

I would like to know at least what situations cause the result of the payPalLauncher.handleReturnToApp() function to be PayPalPaymentAuthResult.NoResult
so I can follow that thread and review the implementation.

The project is a React native application with a Native module for braintree payments

To reproduce

I have been able to reproduce it in two different ways.

The first one by launching a new activity from the native RN module, and the second by implementing the PayPal flow within an RN module.

The fact that I can reproduce the issue from two different scenarios makes me think that the problem might be caused by some external factor that I am not seeing.
I can provide the full code for both scenarios if you think it’s necessary.

        payPalClient.createPaymentAuthRequest(reCurrentActivity!!, request) { paymentAuthRequest ->
            when (paymentAuthRequest) {
                is PayPalPaymentAuthRequest.ReadyToLaunch -> {
                    val pendingRequest = payPalLauncher.launch(reCurrentActivity!!, paymentAuthRequest)
                    when (pendingRequest) {
                        is PayPalPendingRequest.Started -> {
                            pendingString = pendingRequest.pendingRequestString
                        }

                        is PayPalPendingRequest.Failure -> {
                            mPromise.reject("BraintreeSDK Error", pendingRequest.error.message)
                        }
                    }
                }

                is PayPalPaymentAuthRequest.Failure -> {
                    mPromise.reject("BraintreeSDK Error",paymentAuthRequest.error.message)

                }
            }
        }


    private fun handleReturnToApp(intent: Intent) {
        // fetch stored PayPalPendingRequest.Success
        if(this::pendingString.isInitialized){
            when (val paymentAuthResult = payPalLauncher.handleReturnToApp(PayPalPendingRequest.Started(pendingString), intent)) {
                is PayPalPaymentAuthResult.Success -> {
                    completePayPalFlow(paymentAuthResult)
                    // clear stored PayPalPendingRequest.Success
                }
                is PayPalPaymentAuthResult.NoResult -> {
                    // user returned to app without completing PayPal flow, handle accordingly
                    mPromise.reject("BraintreeSDK Error","NO RESULT")

                }
                is PayPalPaymentAuthResult.Failure ->  {

                    mPromise.reject("BraintreeSDK Error", paymentAuthResult.error.message)
                    // handle error case
                }
            }
        }
    }

Expected behavior

Enter the Success case of PayPalPaymentAuthResult.

Screenshots

paypalAndroidFlow.mov
@javier-28
Copy link
Author

hi, any news?

@saperi22
Copy link
Contributor

@javier-28 unfortunately, we do not test for or support react native integrations.
That being said, please let us know if this integration fails for native modules too.

@javier-28
Copy link
Author

Hi @saperi22,

Thank you for your response. We understand that you don’t provide support specifically for React Native implementations; I mentioned it earlier only to clarify the overall context. However, as explained in the initial ticket, the integration we’re using here is native, implemented in Kotlin.

The specific issue arises when calling the function payPalLauncher.handleReturnToApp(PayPalPendingRequest.Started(pendingString), intent). Each time, the result we receive is PayPalPaymentAuthResult.NoResult.

As you can see in the attached video, there are no authorization issues when selecting the payment method.

We would greatly appreciate it if you could told us any factors or dependencies that might lead to consistently obtaining a PayPalPaymentAuthResult.NoResult.

@saperi22
Copy link
Contributor

@javier-28 can you please confirm if you've followed the steps mentioned in the v5_MIGRATION_GUIDE, specifically the App link setup?

@saperi22 saperi22 self-assigned this Oct 31, 2024
@javier-28
Copy link
Author

@saperi22 Yes, we have followed Yes, the steps in the guide.

@saperi22
Copy link
Contributor

saperi22 commented Nov 5, 2024

@javier-28 would you be able to provide a minimally reproducible sample for this issue?
Please do not include any sensitive information.

@Pavel87
Copy link

Pavel87 commented Nov 14, 2024

Hi @saperi22,
We are just updating to 5.2 and having same issue where result goes to NoResult. After login inside PayPal the app switch correctly back and intent received seems to have a valid data but still the result of payPalLauncher.handleReturnToApp is always NoResult

intent data: some.app.with.braintree://onetouch/v1/success?token=EC-8MX176168Y683725R&ba_token=BA-28N28838CH4927537

  • SDK version 5.2
  • We have native kotlin app

@DukeNuker
Copy link

I also have the same problem. It returns NoResult instead of Success, although in the browser it looks like it was successful.

SDK 5.2.0 and native kotlin app

@saperi22
Copy link
Contributor

Hi @saperi22, We are just updating to 5.2 and having same issue where result goes to NoResult. After login inside PayPal the app switch correctly back and intent received seems to have a valid data but still the result of payPalLauncher.handleReturnToApp is always NoResult

intent data: some.app.with.braintree://onetouch/v1/success?token=EC-8MX176168Y683725R&ba_token=BA-28N28838CH4927537

  • SDK version 5.2
  • We have native kotlin app

Can you confirm if that was in sandbox or production?

@saperi22
Copy link
Contributor

@javier-28 @Pavel87 @DukeNuker Can you all confirm one thing for me.
Is 'Open supported links' set to 'Allow app to open supported links' in your app settings? [Long click on the app icon -> App Info ⓘ -> Advanced -> Open by default -> Open supported links]

@DukeNuker
Copy link

@saperi22 Yes this is allowed. I think I've found the problem. I didn't set the App Link Support in the PayPal Control Panel (https://github.com/braintree/braintree_android/blob/main/APP_LINK_SETUP.md). I can't set it now and test it, because my customer needs to do that (I don't have the rights yet). Could this be the reason? If so, then the "NoResult" error does not indicate that.

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

No branches or pull requests

4 participants