confirmSetupIntent method

  1. @override
Future<SetupIntent> confirmSetupIntent(
  1. String setupIntentClientSecret,
  2. PaymentMethodParams data,
  3. PaymentMethodOptions? options
)
override

Implementation

@override
Future<SetupIntent> confirmSetupIntent(
  String setupIntentClientSecret,
  PaymentMethodParams data,
  PaymentMethodOptions? options,
) async {
  final response = await data
      .maybeWhen<Future<stripe_js.SetupIntentResponse>>(card: (params) {
    final data = stripe_js.ConfirmCardSetupData(
      paymentMethod: stripe_js.CardPaymentMethodDetails(
        card: element!,
        billingDetails: params.billingDetails?.toJs(),
      ),
    );
    return js.confirmCardSetup(
      setupIntentClientSecret,
      data: data,
    );
  }, orElse: () {
    throw UnimplementedError();
  });
  if (response.error != null) {
    throw response.error!;
  }

  return response.setupIntent!.parse();
}