jonasbark / flutter_stripe_payment

[DISCONTINUED] A flutter plugin with stripe payment plugin integration
MIT License
308 stars 244 forks source link

Safari webview is never closed after 3d secure is passed #237

Open caseyryan opened 3 years ago

caseyryan commented 3 years ago

I'm testing a payment by card with a 3d secure enabled on iOS 14.2. Here's what I'm doing: 1)

var paymentMethod = await StripePayment.paymentRequestWithCardForm(
    CardFormPaymentRequest(),
 );

2) Pass this testing card 4000000000003063 3) After I got the paymentMethodId I call payment completion like this:

var paymentIntentResult = await StripePayment.confirmPaymentIntent(
    PaymentIntent(
      clientSecret: clientSecret,
      paymentMethodId: paymentMethodId,
      returnURL: 'kyla://stripe-redirect',
    ),
  );

4) After that I see a Safari webview which allows me to complete the 3d secure check. 5) Then it redirects to a page with a button saying "Return to merchant". The button doesn't work. And the webview must be closed manually by pressing Close button in the top left corner. Meanwhile I see that the payment is really completed in my app's console. The deep link is really triggered. If I do not pass returnURL, nothing happens at this step. So it works. The only problem is that Safari isn't closing

Here is how I implemented deep linking in my Info.plist

<key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLName</key>
            <string>kyla</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>kyla://stripe-redirect</string>
            </array>
        </dict>
    </array>

In fact, this is far not the first time I had to implement deep linking in my apps so it's definitely not a problem. I added it here just to demonstrate that this is not what causes the problem.

One more thing. I also tried to pass https://google.com as a returnUrl parameter to confirmPaymentIntent just to make sure the parameter is really catched. It redirected the page to google just fine

caseyryan commented 3 years ago

I added this to AppDelegate.swift

override func application(_ app: UIApplication, open url: URL, options: [UIApplication.OpenURLOptionsKey : Any] = [:]) -> Bool {
    if (url.absoluteString.contains("stripe")) {
        // this code works but doesn't help
        print(url.absoluteString)
        return true;
    }
    return false
}

I didn't help

ldemyanenko commented 3 years ago

Same issue here

prashant-pm commented 2 years ago

same issue here