ezet / stripe-sdk

A simple and flexible Stripe library for Flutter with complete support for SCA and PSD2.
https://pub.dev/packages/stripe_sdk
Other
137 stars 137 forks source link

Web and SCA flow #80

Closed algirdasmac closed 4 years ago

algirdasmac commented 4 years ago

Hi,

It seems that there is an issue on the flutter web with SCA flow - when you try to confirm setup intent ('confirmSetupIntent') future is not returned on the web in case you need SCA.

Let's say you have a card, that requires 3DS confirmation - a new window opens with additional steps that you complete. After completing the steps, you are redirected in this new window to your return URL so in the original window future never completes and keeps hanging.

Short code to illustrate problem:

final stripe = Stripe(
  'my_stripe_key',
  returnUrlForSca: 'https://myawesomewebsite.com/#/new_card',
);

Future<String> createSetupIntentInBackend() => Future.value('client_secret');

Future<bool> createCard(StripeCard card) async {
  var paymentMethod = await stripe.api
      .createPaymentMethodFromCard(card)
      .then((result) => result['id']);
  var clientSecret = await createSetupIntentInBackend();

  //! This future never returns on web.
  return await stripe
      .confirmSetupIntent(clientSecret, paymentMethod)
      .then((result) => result['status'] == 'succeeded');
}

Related issue #35 .

ezet commented 4 years ago

I have unfortunately not had much time to test this with flutter web. I want to support web in the future, but in the current state it is not officially supported, all though I know some people have found it useful for web as well.

jaffakakes commented 3 years ago

im having the same issue web sca is not working