Skip to content

Application Crash when validating payment #445

@ThomasLaTournee

Description

@ThomasLaTournee

We noticed a (rather) small percentage of application crash on our user base on the payment sheet.
After some digging, we can reduce the problem to the following situation:

Platform

  • Web
  • iOS
  • Android

Describe the bug

When returning to the app after it’s been backgrounded (or killed by the system), the Stripe Capacitor plugin’s PluginCall reference is lost. This causes a NullPointerException in PaymentSheetExecutor.onPaymentSheetResult, because the plugin attempts to call currentCall.resolve(...) on a null reference.

To Reproduce
Steps to reproduce the behavior:

0.	In Android Developer Options, enable “Don’t keep activities”. [This allows us to easily reproduce the problem that can only occurs in some edge case (low memory phones, etc..]
1.	Integrate @capacitor-community/stripe v7.2.0 in a Capacitor 7 app
2.	Launch a PaymentSheet (loadPaymentSheet() + presentPaymentSheet()), typically in the 3Dsecure screen waiting for 3DS input
3.	Press Home (or otherwise background the app) while the sheet is still open, go to another app
4.	Return to the app via the task switcher.
5.	Complete or cancel the PaymentSheet flow.
6.	Observe a crash in Logcat:
Caused by java.lang.NullPointerException: Attempt to invoke virtual method  
'void com.getcapacitor.PluginCall.resolve(...)' on a null object reference  
    at com.getcapacitor.community.stripe.paymentsheet.PaymentSheetExecutor.onPaymentSheetResult(...)

Expected behavior
No crash : a way to recover / recreate the activity

Additional context

  • tested and reproduced on several android releases (12, 13, 14, 15) and multiple phones.

Usage Product
If you adopt this plugin, please let us know which product you are using.

Product Name: La Tournée (App)
Product URL : app.la-tournee.co (for the web app), in the apple and google store for the native apps)
Using Function:

  • Payment Sheet / Payment Flow
  • Apple Pay
  • Google Pay
  • Identity (@capacitor-community/stripe-identity)
  • Terminal(@capacitor-community/stripe-terminal)

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