confirmPayment method

Future<Map<String, dynamic>> confirmPayment(
  1. String paymentIntentClientSecret,
  2. BuildContext context, {
  3. String? paymentMethodId,
})

Confirm and authenticate a payment. Returns the PaymentIntent. https://stripe.com/docs/payments/payment-intents/android

Implementation

Future<Map<String, dynamic>> confirmPayment(String paymentIntentClientSecret, BuildContext context,
    {String? paymentMethodId}) async {
  final data = {'return_url': getReturnUrlForSca()};
  if (paymentMethodId != null) data['payment_method'] = paymentMethodId;
  final Map<String, dynamic> paymentIntent = await api.confirmPaymentIntent(
    paymentIntentClientSecret,
    data: data,
  );
  return _handlePaymentIntent(paymentIntent, context);
}