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 · 6 comments
Open

Migration paypal v5: PayPalPaymentAuthResult - NoResult #1184

javier-28 opened this issue Oct 9, 2024 · 6 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.

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

2 participants