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

onPayPalWebCanceled is not called second time #282

Open
yuraj11 opened this issue Nov 7, 2024 · 2 comments
Open

onPayPalWebCanceled is not called second time #282

yuraj11 opened this issue Nov 7, 2024 · 2 comments

Comments

@yuraj11
Copy link

yuraj11 commented Nov 7, 2024

PayPal Android SDK Version

1.7.0

Environment

Sandbox

Android Version & Device

Nexus 6 API 34 Emulator

PayPal dependencies

1.7.0 official demo project dependencies

Describe the bug

I am testing official 1.7.0 Demo application and there is a bug with PayPalWebCheckoutClient. In a specific scenario, when you cancel the payment flow (by closing the webview) it will not inform the app about the cancellation (PayPalWebCheckoutListener#onPayPalWebCanceled). Please check the steps for reproduction.

I noticed that you are using an old version of Browser Switch dependency 2.3.1 so it is possible that migrating to a later version could possibly fix this bug.

Possible bug in Browser Switch library?:
I noticed in BrowserSwichClient is this logic which resets intent in case when the payment was successful:
image

And here is the probematic condition when intent is actually null (when you do first successful payment and then do the same but instead of checkout you cancel the webview) .

image

To reproduce

  1. Open official Demo app
  2. Open PayPal Web -> Authorize -> Create order -> PAYPAL -> Start checkout
  3. Do the payment. After that you will see correct state CHECKOUT COMPLETE
  4. Return back to main screen in Demo app.
  5. Repeat step 2.
  6. Don't do the payment, just press "X" to cancel the payment WebView.
  7. BUG: You will not receive onPayPalWebCanceled(...) in this scenario. Demo app is stuck in infinite loading state. See picture below:
image

Expected behavior

PayPal SDK must correctly trigger onPayPalWebCanceled(...) in all scenarios.

Screenshots

No response

@sshropshire
Copy link
Collaborator

Hi @yuraj11 thank you for using the PayPal SDK for Android. Unfortunately, this is by design. The Chrome Custom Tabs API historically didn't have a hook for the close button. The canceled event is only sent when a user explicitly cancels by clicking a "Cancel" link in the PayPal web app.

I am noticing though that this may now be possible using engagement signals. Is this something high priority for your use case? We've also considered implementing a catch-all NoResult result type in v2 of our SDK when the application comes into the foreground without a successful deep link, because we can't infer the intent of the user with 100% accuracy.

@yuraj11
Copy link
Author

yuraj11 commented Nov 8, 2024

Hi, thanks for the response. Our application shows full-screen loading state until we receive result in listener from the PayPal SDK. I will do a workaround for now, so it's not a high priority.

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