Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS inAppBrowser "Return to Merchant" button does not return back with iDeal, Bancontact and FPX #462

Closed
vladms opened this issue Nov 23, 2021 · 29 comments
Assignees
Labels
blocked This issue is blocked by an external dependency issue bug Something isn't working iOS Issue related to iOS native bindings

Comments

@vladms
Copy link

vladms commented Nov 23, 2021

Describe the bug
I tried paying with iDeal in the example app. The iOS can open the payment link in two ways:

  1. Opening safari as a different app
  2. Opening InAppBrowser

After authorising the payment, the browser should redirect user to the app. This happens only when Safari is opened as a different app. The "Return to Merchant" button gives me this log every time I tap it:
Deep Link does not contain valid required params. URL params: {
"redirect_status" = succeeded;
"setup_intent" = "<.....>";
"setup_intent_client_secret" = "<......>";
}

To Reproduce
Steps to reproduce the behavior:

  1. Download the example app
  2. Change the stripe publishable key
  3. Pay with iDeal
  4. The inAppBrowser is opened
  5. Authorise or decline the payment
  6. Back to merchant is "blocked". Does not take the user back to the app

Expected behavior
After the payment was authorised/declined, the inAppBrowser should open the app

Smartphone / tablet

  • Device: Simulator iPhone 11 Pro Max

  • OS: 14.5

  • Package version: 2.0.2

  • Flutter version 2.5.2

  • Device: Simulator iPhone X

  • OS: 15.1

  • Package version: 2.0.2

  • Flutter version 2.5.2

Additional context
Here is a video of the issue:
Uploading Simulator Screen Recording - iPhone 11 Pro Max - 2021-11-23 at 11.42.46.mp4…

@remonh87 remonh87 added the needs triage Needs triage label Nov 23, 2021
@remonh87
Copy link
Member

Thanks for reporting I think I can reproduce it. The interesting thing is that on the example app the success callback is received. When I print the received routes in the material app I get: ?payment_intent=pi_3Kxxxxxxxx&payment_intent_client_secret=pi_3Kxxxxxx_secret_xxxxxx&redirect_status=succeeded null . I think the return to merchant button not working is something specific to that site though and won't happen in production. Will come back to you on this.

@remonh87 remonh87 self-assigned this Nov 28, 2021
@remonh87
Copy link
Member

Other question can you still upload your video :) ? just to make sure the problem is the same

@remonh87 remonh87 added Awaiting response Awaiting response from the issuer iOS Issue related to iOS native bindings and removed needs triage Needs triage labels Nov 28, 2021
@jamesblasco
Copy link
Member

jamesblasco commented Nov 29, 2021

I think the error is because the example app right now has an invalid urlScheme setup in main.dart
Stripe.urlScheme = 'flutterstripe';

You should ensure a scheme that correctly opens back the app

@vladms
Copy link
Author

vladms commented Dec 2, 2021

The urlScheme is correct because it works when I open the Safari app.
https://user-images.githubusercontent.com/11149275/144453291-56a20bb9-e5c6-4d38-8459-8464ddb2fe71.mp4

@remonh87 I have uploaded the video. Can you reproduce it ?

@remonh87
Copy link
Member

remonh87 commented Dec 9, 2021

@vladms I can reproduce it and I will raise a question to Stripe for advice since when I run it in Safari it works like it should be.

@remonh87 remonh87 added bug Something isn't working and removed Awaiting response Awaiting response from the issuer labels Dec 9, 2021
@jamesblasco jamesblasco changed the title iDeal payment from example app is not redirecting to app on iOS from inAppBrowser iOS inAppBrowser "Return to Merchant" button does not return back with iDeal and Bancontact Dec 11, 2021
@jamesblasco jamesblasco changed the title iOS inAppBrowser "Return to Merchant" button does not return back with iDeal and Bancontact iOS inAppBrowser "Return to Merchant" button does not return back with iDeal, Bancontact and FPX Dec 11, 2021
@vladms
Copy link
Author

vladms commented Jan 5, 2022

@jamesblasco @remonh87 Any updates on this issue?

@remonh87
Copy link
Member

remonh87 commented Jan 6, 2022

@vladms there is no reaction from Stripe yet I will poke them again

@remonh87 remonh87 added the blocked This issue is blocked by an external dependency issue label Jan 6, 2022
@vladms
Copy link
Author

vladms commented Jan 19, 2022

@remonh87 Any answer from Stripe?

@vladms
Copy link
Author

vladms commented Feb 2, 2022

@remonh87 Anything?

@remonh87
Copy link
Member

remonh87 commented Feb 2, 2022

@vladms I am thinking if it can be an issue on the stripe test page. I did some testing on flutter and I noticed the callback is received directly however the page is not closed and I have to press return to merchant. I will play a bit more in the weekend. I think however you wouldn't have issues in production (at least I didn't have ).

@ayushin
Copy link
Contributor

ayushin commented Mar 2, 2022

This is related to #609

Without return_url you'll get whatewhere scheme :/?safepay.... which is not correct in many case and doesn't work across platform.

@Sempakonka
Copy link

Any updates? am also having this issue. Raised an issue #608 where I am not using the example app but experiencing the same behaviour.

@kawaldeep2507
Copy link

Any updates on this? i am also having this issue.

@adar2378
Copy link

adar2378 commented Apr 1, 2022

We're also having the problem where return to merchant is not closing the WebView but deeplink url is returning when we use test failure in test mode.

@nitishk72
Copy link

Fixed after few days of Research 🎉

After going through the Stripe SDK and their official library, I was able to fix it.
As I was in hurry, I fix it in my local and build my app.

Soon I'll share the solution with you all and a PR.

@mvnpavan
Copy link

Fixed after few days of Research 🎉

After going through the Stripe SDK and their official library, I was able to fix it. As I was in hurry, I fix it in my local and build my app.

Soon I'll share the solution with you all and a PR.

Any update.

@gsfeng
Copy link

gsfeng commented May 25, 2022

Fixed after few days of Research 🎉

After going through the Stripe SDK and their official library, I was able to fix it. As I was in hurry, I fix it in my local and build my app.

Soon I'll share the solution with you all and a PR.

Any update??

@anderscheow
Copy link
Contributor

Fixed after few days of Research 🎉

After going through the Stripe SDK and their official library, I was able to fix it.

As I was in hurry, I fix it in my local and build my app.

Soon I'll share the solution with you all and a PR.

Hey sir, any update on this? Need it badly

@remonh87
Copy link
Member

remonh87 commented Jun 6, 2022

Fixed in version 3.1.0 thanks @anderscheow for the fix!

@remonh87 remonh87 closed this as completed Jun 6, 2022
@adar2378
Copy link

adar2378 commented Jun 7, 2022

@anderscheow
On iOS, the in-app browser is still not closing when pressed "Return to Merchant". But the deep link is pushed from the callback in the router. So the user has to manually press the "Close"(in in-app browser) button to go back to the payment success bottomsheet.

Is there anything I'm missing?

Tested on 3.1.0

@Sempakonka
Copy link

@anderscheow

On iOS, the in-app browser is still not closing when pressed "Return to Merchant". But the deep link is pushed from the callback in the router. So the user has to manually press the "Close"(in in-app browser) button to go back to the payment success bottomsheet.

Is there anything I'm missing?

Tested on 3.1.0

I am also still experiencing this behaviour.

@anderscheow
Copy link
Contributor

anderscheow commented Jun 8, 2022

@adar2378 @Sempakonka

Can just follow the example and should have just work

  1. Set url scheme, Stripe.urlScheme = 'examplestripe'
  2. Make sure the same url scheme is configure in Info.plist

@Sempakonka
Copy link

@adar2378 @Sempakonka

Can just follow the example and should have just work

  1. Set url scheme, Stripe.urlScheme = 'examplestripe'
  2. Make sure the same url scheme is configure in Info.plist

Its working, Thanks 🥳

@adar2378
Copy link

adar2378 commented Jun 9, 2022

@adar2378 @Sempakonka
Can just follow the example and should have just work

  1. Set url scheme, Stripe.urlScheme = 'examplestripe'
  2. Make sure the same url scheme is configure in Info.plist

Its working, Thanks 🥳

Hi @Sempakonka Could you share your config for info.plist?

I've added

<dict> <key>CFBundleTypeRole</key> <string>Editor</string> <key>CFBundleURLName</key> <string>safepay</string> <key>CFBundleURLSchemes</key> <array> <string>flutterstripe</string> </array> </dict>
Also Stripe.urlScheme = 'flutterstripe';

But still it is not closing the webview from 'Return to merchant'

Could it be the returnUrl need to match flutterStripe://safepay/ as prefix?

@Sempakonka
Copy link

@adar2378

	<array>
		<dict>
			<key>CFBundleTypeRole</key>
			<string>Editor</string>
			<key>CFBundleURLName</key>
			<string>com.mycompany.myapp</string>
			<key>CFBundleURLSchemes</key>
			<array>
				<string>com.mycompany.myapp</string>
			</array>
		</dict>
	</array>

In Dart:
Stripe.urlScheme = 'com.divics.svglanerbrug-dev://safepay';
Both need to be the same.

@nitishk72
Copy link

I solved this solution more in the way which is recommended by the Stripe team.

  • I look into the react-native stripe first
  • I found that it react-native takes the deep link and then closes the app
  • This means to close the webview, flutter needs to send the event to the stripe plugin.

handleURLCallback is being called on react native side to close the webview. The solution that @anderscheow sent does the same using the swift side. This thing should be done from the flutter side to have the same logic and standard.

@victorkennedys
Copy link

@nitishk72 I do not understand how you solved the issue as per your latest post in this thread. Can you explain a bit more please?

@victorkennedys
Copy link

Anyone else who has a solution for this? Would be really greatful!

@saiful-apx
Copy link
Contributor

This should fix the issue with handleURLCallback method. From Flutter side whenever the deep-link is pushed we will need to pass the full redirect url sent from stripe to Stripe.instance.handleURLCallback method. This will close the webview.

#939

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked This issue is blocked by an external dependency issue bug Something isn't working iOS Issue related to iOS native bindings
Projects
None yet
Development

No branches or pull requests