When using the flutter_stripe package with the latest Stripe backend API version 2025-06-30.basil, calling Stripe.instance.confirmSetupIntent results in an Invalid argument(s): 'Klarna' is not one of the supported values error.
Code:
// 2. Confirm setup intent
final setupIntentResult = await Stripe.instance.confirmSetupIntent(
paymentIntentClientSecret: setupIntentClientClientSecret,
params: PaymentMethodParams.card(paymentMethodData: PaymentMethodData(billingDetails: billingDetails)),
);
Error Log
I/flutter (26384): ----------------FIREBASE CRASHLYTICS----------------
I/flutter (26384): Invalid argument(s): `Klarna` is not one of the supported values: AfterpayClearpay, Card, CashApp, Alipay, Grabpay, Ideal, Fpx, CardPresent, SepaDebit, AuBecsDebit, BacsDebit, Giropay, P24, Eps, Bancontact, Oxxo, PayPal, Sofort, Upi, USBankAccount, RevolutPay, Unknown
I/flutter (26384): #0 $enumDecode (package:json_annotation/src/enum_helpers.dart:83:5)
I/flutter (26384): #1 _$$SetupIntentImplFromJson.<anonymous closure> (package:stripe_platform_interface/src/models/setup_intent.g.dart:17:64)
I/flutter (26384): #2 MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
I/flutter (26384): #3 ListIterator.moveNext (dart:_internal/iterable.dart:371:26)
I/flutter (26384): #4 new _GrowableList._ofEfficientLengthIterable (dart:core-patch/growable_array.dart:190:27)
I/flutter (26384): #5 new _GrowableList.of (dart:core-patch/growable_array.dart:150:28)
I/flutter (26384): #6 new List.of (dart:core-patch/array_patch.dart:40:18)
I/flutter (26384): #7 ListIterable.toList (dart:_internal/iterable.dart:224:7)
I/flutter (26384): #8 _$$SetupIntentImplFromJson (package:stripe_platform_interface/src/models/setup_intent.g.dart:17:108)
I/flutter (26384): #9 new _$SetupIntentImpl.fromJson (package:stripe_platform_interface/src/models/setup_intent.freezed.dart:350:7)
I/flutter (26384): #10 _$SetupIntentFromJson (package:stripe_platform_interface/src/models/setup_intent.freezed.dart:18:23)
I/flutter (26384): #11 new SetupIntent.fromJson (package:st
I/flutter (26384): ----------------------------------------------------
Root Cause:
The issue stems from a discrepancy between the flutter_stripe package's PaymentMethodType enum and the latest Stripe backend API. The Stripe backend now includes "Klarna" as a valid payment method, but it is not yet recognized within the stripe_platform_interface package. This causes the deserialization process to fail when a SetupIntent object (or related data) containing "Klarna" is received from the Stripe API, as the Klarna value is treated as Unknown.
The problem specifically lies in flutter_stripe/packages/stripe_platform_interface/lib/src/models/payment_methods.dart and other files where PaymentMethodType enum is utilized.
Proposed Solution (and already implemented in a forked repo):
This can be resolved by:
Adding Klarna as a new value to the PaymentMethodType enum in flutter_stripe/packages/stripe_platform_interface/lib/src/models/payment_methods.dart.
Running build_runner in all relevant flutter_stripe packages to regenerate the necessary *.g.dart and *.freezed.dart files.
I have already implemented this fix in a forked repository and created a pull request. I kindly request an urgent review and merge of the pull request to resolve this critical issue, which is currently preventing the use of confirmSetupIntent with the latest Stripe API version.
Link to pull request: #2175
When using the flutter_stripe package with the latest Stripe backend API version 2025-06-30.basil, calling Stripe.instance.confirmSetupIntent results in an Invalid argument(s): 'Klarna' is not one of the supported values error.
Code:
Error Log
Root Cause:
The issue stems from a discrepancy between the flutter_stripe package's PaymentMethodType enum and the latest Stripe backend API. The Stripe backend now includes "Klarna" as a valid payment method, but it is not yet recognized within the stripe_platform_interface package. This causes the deserialization process to fail when a SetupIntent object (or related data) containing "Klarna" is received from the Stripe API, as the Klarna value is treated as Unknown.
The problem specifically lies in flutter_stripe/packages/stripe_platform_interface/lib/src/models/payment_methods.dart and other files where PaymentMethodType enum is utilized.
Proposed Solution (and already implemented in a forked repo):
This can be resolved by:
Adding Klarna as a new value to the PaymentMethodType enum in flutter_stripe/packages/stripe_platform_interface/lib/src/models/payment_methods.dart.
Running build_runner in all relevant flutter_stripe packages to regenerate the necessary *.g.dart and *.freezed.dart files.
I have already implemented this fix in a forked repository and created a pull request. I kindly request an urgent review and merge of the pull request to resolve this critical issue, which is currently preventing the use of confirmSetupIntent with the latest Stripe API version.
Link to pull request: #2175