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

returnUrlForSca: How to se up a dynamic link (with format https://...) when kIsWeb=false #142

Open danielo17 opened 3 years ago

danielo17 commented 3 years ago

Hello,

I'm busy with a stripe integration with stripe-sdk. Great library btw.

I need to have my app 3DSecure ready, therefore I'm testing with cards forcing the extra authentication step. A dynamic link is supposed to bring back the user to the app once this is done.

Everything works fine for me, except that I don't manage to set up the dynamic link, because the library seems to be forcing NOT to have an http://... format. Checking the code in stripe-sdk, this is the part that Is blocking me.

_bool _isValidScheme() { var isHttpScheme = ['http', 'https'].contains(returnUrlForSca.split(':')[0]); if (kIsWeb) { assert(isHttpScheme, 'Return URL schema must be http/https when compiled for web.'); } else { assert(!isHttpScheme, 'Return URL schema must not http/https when compiled for mobile.'); } return true; }

If I comply with the "non http" format, I get an error when stripe redirects back.

I had a look to the Stripe API and seems to be no limitation in this sense. An optional param "returnURL" can be passed to ConfirmPaymentIntent, which is what I'm doing.

Did anyone set up a dynamic link -a deep link- (so that the URL redirects to a particular) part of the application to continue successfully using this library?

Many thanks in advance.

ezet commented 2 years ago

I haven't considered this case. The check is there to make sure users don't accidentally use https on ios/android, as that is usually not what you want. I'll consider support for dynamic links in the future. The library is set up to automatically handle the deeplink for you after 3ds, using traditional deeplink mechanics.