Invalid argument(s): `automatic_async` is not one of the supported values: automatic, manual
Describe the bug
ncaught (in promise) Error: Invalid argument(s): `automatic_async` is not one of the supported values: automatic, manual
at Object.throw_ [as throw] (errors.dart:297:3)
at Object.$36enumDecodeNullable [as $enumDecodeNullable] (enum_helpers.dart:37:5)
at Object._$36$36PaymentIntentImplFromJson [as _$$PaymentIntentImplFromJson] (payment_intent.g.dart:32:22)
at _$36PaymentIntentImpl.fromJson (payment_intent.freezed.dart:892:7)
at Object._$36PaymentIntentFromJson [as _$PaymentIntentFromJson] (payment_intent.freezed.dart:18:25)
To Reproduce Steps to reproduce the behavior:
await Stripe.instance.confirmPayment(
paymentIntentClientSecret: paymentIntent['client_secret'],
data: PaymentMethodParams.card(
paymentMethodData: PaymentMethodData(
billingDetails: billingDetails,
),
),
options: const PaymentMethodOptions(
setupFutureUsage: PaymentIntentsFutureUsage.OnSession,
),
);
Expected behavior Dont have error.
Smartphone / tablet
- Device: WEB Chrome
- Package version: stripe_js "3.4.0"
- Flutter version Flutter 3.19.6
Additional context #1608
Faced the same issue. Looks like the PaymentIntentCaptureMethod enum is missing the automatic_async value.
Would be nice the fix this issue ASAP, but until that I will switch to automatic capture method, even though automatic_async would be faster based on docs (https://docs.stripe.com/payments/payment-intents/asynchronous-capture?locale=en-GB)
Below is a screenshot if it helps somebody to create a PR which fixes this issue:
I'm also experiencing the same issue on my new integration of stripe (focused on the web). I'm unsure if it's an issue on mobile though. Is there a timeline for these things @remonh87?
There is any update on this bug? @remonh87
Hi @jonasbark, @remonh87, could you please provide any help here?
automatic_async is crucial to avoid redirects in PWA that creates issues in the user experience. Thanks a lot for your support.
@Dall127 This does not appear to be an issue on mobile. But I'm having the same problem as everyone else on web. I generate my Intent in node like so:
const paymentIntentCreateParams: Stripe.PaymentIntentCreateParams = {
amount: _amount,
currency: 'usd',
statement_descriptor_suffix: _suffix,
metadata: metadata,
confirm: false,
description: _description,
customer: _customerID,
capture_method: "automatic", // todo - added this because web was throwing from default of "automatic_async"
};
and until I explicitly set capture_method to be automatic (from not setting it at all) it was throwing on my client side and not returning a PaymentIntent as expected. I had my WebStripe.instance.confirmPaymentElement in a try/catch and even successful captures on Stripe's end would throw to the following:
print('type = ${e.runtimeType}');
print(e.toString());
and result in:
type = _Exception
Exception: automaticAsync is not a valid capture method
with capture_method: "automatic", it finally returned a PaymentIntent on the client.