flutter-stripe / flutter_stripe

Flutter SDK for Stripe.
https://pub.dev/packages/flutter_stripe
947 stars 522 forks source link

HELP NEEDED: Missing return_url parameter for IDEAL payments #609

Closed ayushin closed 2 years ago

ayushin commented 2 years ago

This is not a duplicate of #225

While you can set urlScheme this does not work with universal links - we really do need to be able to pass return_url to IDEAL payment confirmation in order to be able to handle payments across platforms.

Stripe example:

    } = await stripe.confirmIdealPayment(clientSecret, {
      payment_method: {
        ideal: elements.getElement(IdealBankElement),
        billing_details: {
          name: 'Jenny Rosen',
        },
      },
      return_url: `${window.location.origin}/ideal?return=true`,
ayushin commented 2 years ago

Also window.location.href should not be used as return_url blindly in stripe_web.dart if return_url is specified

ayushin commented 2 years ago

I could use some help to implement this workaround on Android:

https://github.com/flutter-stripe/flutter_stripe/pull/610

remonh87 commented 2 years ago

fixed as part of 2.4.0.

davidmigloz commented 1 year ago

I see that you can specify a returnUrl if you are using the payment sheet:

https://github.com/flutter-stripe/flutter_stripe/blob/4d47412fe49353c955c9ecabe9b1875e4ebc3fbe/packages/stripe_platform_interface/lib/src/models/payment_sheet.freezed.dart#L85

But if you are using the sdk's webview you don't have any option to specify a returnUrl. So, in iOS we are forced to use custom URL scheme instead of being able to use universal links.

https://github.com/flutter-stripe/flutter_stripe/blob/4d47412fe49353c955c9ecabe9b1875e4ebc3fbe/packages/stripe_ios/ios/Classes/Stripe%20Sdk/Mappers.swift#L746-L748

Also for web, returnUrl is still hardcoded to window.location.href:

https://github.com/flutter-stripe/flutter_stripe/blob/4d47412fe49353c955c9ecabe9b1875e4ebc3fbe/packages/stripe_web/lib/src/web_stripe.dart#L153

Would it be possible to expose returnUrl in confirmPayment() method so that we can use universal links in iOS and have more flexibility in web?