-
Notifications
You must be signed in to change notification settings - Fork 69
Description
PayPal Android SDK Version
2.3.0
Environment
Sandbox
Android Version & Device
Google Pixel 8 Pro API 34
PayPal dependencies
gradle/libs.versions.toml
[versions]
paypalWebPayments = "2.3.0"
[libraries]
paypal-web-payments = { module = "com.paypal.android:paypal-web-payments", version.ref = "paypalWebPayments" }
Describe the bug
When users taps the X button in the Chrome Custom Tab toolbar to close the browser during the PayPal checkout/vault flow, there is no callback or indication that the user has abandoned the flow. The activity simply resumes with onResume() but with no way to distinguish this from normal app minimization (e.g., user pressing home button).
The problem:
Without a way to detect browser dismissal, we were are unable to detect/determine if the SDK has been closed or minimised etc
Attempted workaround:
We have created a workaround to compensate for this in the onResume():
// Handles default PayPal SDK intent callbacks)
override fun onNewIntent(intent: Intent) {
super.onNewIntent(intent)
setIntent(intent)
viewModel.handleDeeplinkResult(this, intent)
}
// Workaround to cater for SDK browser closing
override fun onResume() {
super.onResume()
// Check if returning without deep link
if (hasStartedCheckout && intent?.data == null) {
finishWithCancellation() // Treat as user cancellation
}
}
Why this doesn't work:
This approach incorrectly triggers cancellation when users simply minimize the app (press home) and later return to it, causing false cancellations and interrupting legitimate flows.
To reproduce
- Launch the PayPal checkout/vault flow
- Chrome Custom Tab opens with PayPal login/payment page
- Click the X button in the browser toolbar (top-left on Android)
- Browser closes, app resumes
- Observe: No callbacks triggered ie. onNewIntent() etc
Expected behavior
The expected behaviour is for this to work the same way we handle the "Cancel and Return to Store" flow.
SDK provides a callback or result when the browser is dismissed via X button (similar to how the "Cancel and Return to Store" flow is handled
Screenshots
