flutter_stripe
flutter_stripe copied to clipboard
"sepa_debit" doesn't work with SetupIntents
Describe the bug
If you use "sepa_debit"
as one of the payment_method_types
of a Setup Intent it doesn't appears in the Payment Sheet. If it is the only payment method type it causes an app crash.
To Reproduce create a setup intent server side:
await stripe.setupIntents.create({
usage : 'off_session',
payment_method_types : ['sepa_debit']
});
in client app:
await Stripe.instance.initPaymentSheet(
paymentSheetParameters: SetupPaymentSheetParameters(
customFlow: false,
allowsDelayedPaymentMethods : true,
merchantDisplayName: 'xyz',
setupIntentClientSecret: 'seti_XXX',
));
await Stripe.instance.presentPaymentSheet();
causes:
E/AndroidRuntime( 972): Process: app.abc.def, PID: 972 E/AndroidRuntime( 972): java.util.NoSuchElementException: List is empty. E/AndroidRuntime( 972): at kotlin.collections.CollectionsKt___CollectionsKt.first(_Collections.kt:214) E/AndroidRuntime( 972): at com.stripe.android.paymentsheet.ui.AddPaymentMethodKt.getInitiallySelectedPaymentMethodType(AddPaymentMethod.kt:140) E/AndroidRuntime( 972): at com.stripe.android.paymentsheet.ui.AddPaymentMethodKt.access$getInitiallySelectedPaymentMethodType(AddPaymentMethod.kt:1) E/AndroidRuntime( 972): at com.stripe.android.paymentsheet.ui.AddPaymentMethodKt$AddPaymentMethod$selectedPaymentMethodCode$2.invoke(AddPaymentMethod.kt:50) E/AndroidRuntime( 972): at com.stripe.android.paymentsheet.ui.AddPaymentMethodKt$AddPaymentMethod$selectedPaymentMethodCode$2.invoke(AddPaymentMethod.kt:49)
Smartphone / tablet
- Device: Pixel 6
- OS: Android 10
- Package version: 9.0.0+1
- Flutter version 3.3.1
Additional context Using it with Payment Intents it works as aspected. A Checkout Session created with the same parameters also works as aspected.
That looks like an internal bug of the stripe-android library. I recommend adding a ticket in https://github.com/stripe/stripe-android
I was able to complete a paymewnt for setupintent with sepa debit