confirmIdealPayment method

Future<PaymentIntent> confirmIdealPayment(
  1. String paymentIntentClientSecret,
  2. PaymentMethodDataIdeal paymentData, {
  3. String? returnUrl,
})

Implementation

Future<PaymentIntent> confirmIdealPayment(
    String paymentIntentClientSecret, PaymentMethodDataIdeal paymentData,
    {String? returnUrl}) async {
  if (paymentData.bankName == null) throw 'bankName is required for web';
  // https://stripe.com/docs/js/payment_intents/confirm_alipay_payment#stripe_confirm_alipay_payment-options
  final response = await js.confirmIdealPayment(
    paymentIntentClientSecret,
    data: stripe_js.ConfirmIdealPaymentData(
      paymentMethod: stripe_js.IdealPaymentMethodDetails.withBank(
        ideal: stripe_js.IdealBankData(bank: paymentData.bankName!),
      ),
      returnUrl: returnUrl ?? urlScheme,
    ),
  );

  if (response.error != null) {
    throw StripeError(
      message: response.error!.message ?? '',
      code: response.error!.code,
    );
  }

  return response.paymentIntent!.parse();
}