capacitor-community / stripe

Stripe Mobile SDK wrapper for Capacitor
MIT License
185 stars 74 forks source link

Better error reporting #200

Closed joshstrange closed 1 year ago

joshstrange commented 1 year ago

Is your feature request related to a problem? Please describe. So I'm not sure if there is a lot of low-hanging fruit on this topic or not but one issue I ran into recently was made a lot worse because there appears to be no logging/indication of what's going wrong.

In my case the Stripe Publishable Key for Android (that is defined in app/src/main/res/values/strings.xml) wasn't getting updated so my production app had a test key instead of a live one. There were no error/debug messages at all in the logcat console and the plugin didn't throw any errors. I would see the PaymentSheet start to open then close midway through sliding up.

Describe the solution you'd like It would be nice if Stripe.presentPaymentSheet() threw an error when this happened since that's what I was trying to open but it was failing.

Describe alternatives you've considered Barring an error thrown at time of opening I'd settle for a way to listen for error messages (more than what's available) that actually has a payload/error instead of just an event with no data. I feel like the underlying Stripe SDK must have thrown some error but it never bubbled up to javascript.

Additional context This should be easy to reproduce. Just use a "live" paymentIntentId/customerId/customerEphemeralKeySecret and make sure your publishable_key is a "test" key.

rdlabo commented 1 year ago

Thanks for issue.

You should check here: https://github.com/capacitor-community/stripe/blob/master/android/src/main/java/com/getcapacitor/community/stripe/paymentsheet/PaymentSheetExecutor.java#L102

Unfortunately, there is nothing this plugin can do, since the STRIPE library itself does not throw errors. (Although it does CATCH the errors...).

Please do let stripe-team know what you think of stripe android: https://github.com/stripe/stripe-android

Thanks.

rdlabo commented 1 year ago

This Issue will be closed because it has not been updated for a long time. If you encounter similar problems, please start a new Issue.