Skip to content

Bug: No Way to Abort PayPal/Venmo Flow When Host App Session Expires During App SwitchΒ #1552

@HarminderSinghSandhu

Description

@HarminderSinghSandhu

Braintree SDK Version

5.18.0

Environment

Both

Android Version & Device

10+

Braintree dependencies

// Braintree
implementation(libs.braintree.paypal)
implementation(libs.braintree.venmo)

Describe the bug

Summary
While integrating the Braintree Android SDK, the host app session (not the SDK) may expire when the app is backgrounded during PayPal (Chrome Custom Tab) or Venmo (app switch) flows. In such cases, the app cannot safely continue the payment. However, there is no SDK-supported way to programmatically abort or close the ongoing external flow, leading to inconsistent UX and broken payment handling.


πŸ“¦ Affected Library

  • Braintree Android SDK

βš™οΈ Environment

  • Platform: Android

  • Integration Type:

    • PayPal (Chrome Custom Tabs)
    • Venmo (App Switch)
  • OS Versions: Android 10+

  • Devices: Multiple


🚨 Actual Behavior

  • Host app session expires during external flow

  • On return:

    • App detects invalid session
    • Payment flow is no longer valid
  • However:

    • No SDK API to abort or close:

      • PayPal Chrome Custom Tab
      • Venmo app flow
  • Results in:

    • Broken user experience
    • Forced manual restart of app/payment

πŸ“Œ Observations

  • This issue is caused by host app session lifecycle, not SDK token expiry

  • App switch is mandatory for:

    • PayPal (browser-based flow)
    • Venmo (external app)
  • Android platform restrictions prevent direct control of external apps

  • However, SDK does not provide any abstraction to handle this edge case


πŸ§ͺ Acceptance Criteria

  • Host app can detect session expiry and safely invalidate payment
  • SDK provides a structured way to abort or reset flow
  • No undefined or broken state when user returns after session expiry

🏷️ Labels

bug, android, braintree-sdk, paypal, venmo, app-session, app-switch, lifecycle


To reproduce

πŸ” Steps to Reproduce

  1. Host app starts with a valid authenticated session

  2. Initiate PayPal or Venmo payment via Braintree SDK

  3. SDK launches:

    • PayPal β†’ Chrome Custom Tab
    • Venmo β†’ Venmo app
  4. App goes to background

  5. Host app session expires while user is in external flow

  6. User completes or exits payment and returns to app

Expected behavior

❗ Expected Behavior

  • SDK should provide a mechanism to:

    • Allow the host app to abort/cancel the payment flow when it detects session expiry
    • Safely bring user back to app in a controlled state
    • Prevent continuation of an invalid or unauthorized payment flow

Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions