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

[BUG] Crash PaymentSheetResult$Failed.writeToParcel #7827

Closed
FlorentDambreville opened this issue Jan 25, 2024 · 12 comments
Closed

[BUG] Crash PaymentSheetResult$Failed.writeToParcel #7827

FlorentDambreville opened this issue Jan 25, 2024 · 12 comments
Labels

Comments

@FlorentDambreville
Copy link

FlorentDambreville commented Jan 25, 2024

Summary

Our users are experiencing a new crash when upgrading our application. We only have updated the stripe SDK from 20.34.4 to 20.36.1
Here is the stacktrace:

Fatal Exception: android.os.BadParcelableException: Parcelable encountered IOException writing serializable object (name = ix.m$d)
       at android.os.Parcel.writeSerializable(Parcel.java:2763)
       at com.stripe.android.paymentsheet.PaymentSheetResult$Failed.writeToParcel(PaymentSheetResult.kt:8)
       at android.os.Parcel.writeParcelable(Parcel.java:2550)
       at com.stripe.android.paymentsheet.PaymentSheetContractV2$Result.writeToParcel(PaymentSheetContractV2.kt:8)
       at android.os.Parcel.writeParcelable(Parcel.java:2550)
       at android.os.Parcel.writeValue(Parcel.java:2451)
       at android.os.Parcel.writeValue(Parcel.java:2328)
       at android.os.Parcel.writeArrayMapInternal(Parcel.java:1277)
       at android.os.BaseBundle.writeToParcelInner(BaseBundle.java:1802)
       at android.os.Bundle.writeToParcel(Bundle.java:1362)
       at android.os.Parcel.writeBundle(Parcel.java:1346)
       at android.content.Intent.writeToParcel(Intent.java:12206)
       at android.os.Parcel.writeTypedObject(Parcel.java:2169)
       at android.app.IActivityClientController$Stub$Proxy.finishActivity(IActivityClientController.java:1450)
       at android.app.ActivityClient.finishActivity(ActivityClient.java:164)
       at android.app.Activity.finish(Activity.java:6845)
       at android.app.Activity.finish(Activity.java:6862)
       at com.stripe.android.paymentsheet.ui.BaseSheetActivity.finish(BaseSheetActivity.kt:44)
       at com.stripe.android.paymentsheet.PaymentSheetActivity$onCreate$2$1$1$1.emit(PaymentSheetActivity.kt:74)
       at com.stripe.android.paymentsheet.PaymentSheetActivity$onCreate$2$1$1$1$emit$1.invokeSuspend(PaymentSheetActivity.kt:13)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.internal.ScopeCoroutine.afterResume(Scopes.kt:33)
       at kotlinx.coroutines.AbstractCoroutine.resumeWith(AbstractCoroutine.kt:102)
       at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46)
       at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
       at androidx.compose.ui.platform.AndroidUiDispatcher.performTrampolineDispatch(AndroidUiDispatcher.android.kt:81)
       at androidx.compose.ui.platform.AndroidUiDispatcher.access$performTrampolineDispatch(AndroidUiDispatcher.android.kt:41)
       at androidx.compose.ui.platform.AndroidUiDispatcher$dispatchCallback$1.run(AndroidUiDispatcher.android.kt:57)
       at android.os.Handler.handleCallback(Handler.java:942)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:226)
       at android.os.Looper.loop(Looper.java:313)
       at android.app.ActivityThread.main(ActivityThread.java:8762)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:604)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1067)

stripe crash stacktrace.txt

Code to reproduce

We are using the payment sheet as advice in the documentation (sorry for the lack of details).
I can provide piece of our code :

Payment Sheet creation

paymentSheet = PaymentSheet(this) {
            viewModel.onPaymentSheetResult(it)
        }

Payment sheet presentation

paymentSheet.presentWithPaymentIntent(
                viewModel.paymentIntent!!.clientSecret,
                PaymentSheet.Configuration(
                    getString(R.string.app_name),
                    customer = viewModel.customerConfig,
                    defaultBillingDetails = viewModel.billingDetails,
                    appearance = libonStripeTheme.buildPaymentSheetAppearance(),
                    googlePay = viewModel.googlePayConfiguration
                )
            )

Android version

Version 10, 11, 12 & 13

Impacted devices

Samsung, Oppo, Honor

Installation method

gradle dependency

Dependency Versions

kotlin: 1.8.10
stripe-android: 20.36.1 (upgraded from 20.34.4) NEW: 20.29.0
Android Gradle Plugin: 8.2.1
Gradle: 8.2

SDK classes

PaymentSheetResult

Other information

@jaynewstrom-stripe
Copy link
Collaborator

Hi @FlorentDambreville thanks for the report.

It looks like the cause was a class by the name of dw.l0. I'm assuming you use R8 to minify your code. Would you happen to have the mapping file that would explain the actual source of that minified class name?

@FlorentDambreville
Copy link
Author

FlorentDambreville commented Jan 26, 2024

Yes you are right, we use R8 to minify our code. However, the mapping file is already used in Firebase Crashlytics. So i believe our minified classes are already translated into readable name.

I assumed (maybe I shouldn't) that the dw.10 was an obfuscated class on another side. Actually, I thought the same for the other mentioned piece of code responsible for the crash : name = ix.m$d.

Is it possible the obfuscated classes are on your side ?

@FlorentDambreville
Copy link
Author

FlorentDambreville commented Jan 26, 2024

May I add a relevant information :

We ask for 3DS authentication every time and it seems that all the transactions concerned are challenged and not frictionless on the 3DS side.

The crash seems to occurs when users return to the application after 3DS authentication.

@FlorentDambreville
Copy link
Author

Hello again

It seems the crash doesn't keep the users from buying. The purchases seems to have been a success.

Also : is it possible the bug you solved in the 20.37.1 solves our issue too ?

@jaynewstrom-stripe
Copy link
Collaborator

I don't think #7822 would fix this issue.

Are you sure that this bug is being hit with successful transactions? It looks like this should only happen in failure cases, and Canceled and Completed cases wouldn't hit this.

Are you able to reproduce this locally?

@FlorentDambreville
Copy link
Author

Ok too bad.

No in fact it seems to happen for both successful and failed transaction. What let me think that is the time of crash and successful transaction that are sometime the same and sometimes not.

We are currently trying to reproduce the crash locally without success so far

@FlorentDambreville
Copy link
Author

Hello,

We have new occurrences of the same crash on older version of Stripe (20.29.0)

Is it possible the cause is not the Stripe SDK but the mecanisms behind ?

@arkalezard
Copy link

arkalezard commented Feb 2, 2024

I don't think #7822 would fix this issue.

Are you sure that this bug is being hit with successful transactions? It looks like this should only happen in failure cases, and Canceled and Completed cases wouldn't hit this.

Are you able to reproduce this locally?

Hi @jaynewstrom-stripe ,
We released a hotfix with your lastest version 20.37.1
The issue is still there.

Are you sure that this bug is being hit with successful transactions?
We have many successful transactions with this crash.

Are you able to reproduce this locally?
Our QA tried many times but we didn't reproduce it

Based on my understanding,

  1. User is openning Stripe sheet in our application
  2. They're picking their payment method
  3. User is opening their bank application to confirm 3DS (another app)
  4. User is coming back in our first app where Stripe sheet was opened
  5. BLING 💥

@jaynewstrom-stripe
Copy link
Collaborator

I was able to reproduce this locally (when launching payment sheet with an already confirmed payment intent). I have a fix PR'd.

@jaynewstrom-stripe
Copy link
Collaborator

Fix merged in ##7872

@FlorentDambreville
Copy link
Author

Awesome thx 🚀

@jaynewstrom-stripe
Copy link
Collaborator

@FlorentDambreville It's also worth noting, you shouldn't have hit this bug if your integration was optimal. Please ensure you aren't trying to present PaymentSheet with an already confirmed payment intent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
3 participants