pwa-builder / PWABuilder

The simplest way to create progressive web apps across platforms and devices. Start here. This repo is home to several projects in the PWABuilder family of tools.
https://docs.pwabuilder.com
Other
2.66k stars 279 forks source link

[BUG] Payment gateways are breaking the app in iOS #4592

Closed rajandimri closed 7 months ago

rajandimri commented 7 months ago

What happened?

So the issue is that -

  1. Packaged the PWA for iOS
  2. Having multiple payment options on the checkout that redirect the customers to the third-party payment gateways to complete the checkout
  3. Now when the customer selects the payment method like net-banking/ UPI/ or other options it breaks the app functionality and restarts the app

My POV:

  1. The issue seems to be due to the redirection involving different domains, which seems like CORS (Cross-Origin Requests).
  2. I can add the these different URL's in the setting of the app in "authOrigins"
  3. But it involves multiple URLs when it comes to third-party payment gateways. And adding those URLs doesn't seems to be a good approach.

Is there any fix to this?

How do we reproduce the behavior?

  1. Go to the packaged app on iOS
  2. Add the products to the cart
  3. Go the the checkout page
  4. If you have multiple third-party payment gateways a. After redirecting to the third party payment gateways when choose the payment options the app will restart
  5. It happens only when using third-party payment gateways and redirect the users to the third-party payment gateway URLs and when customer select the payment option

What do you expect to happen?

  1. After selecting the payment option user should be able to complete the payment and redirect back to the order completion order page on the website.
  2. It is working perfect on android and windows PWA

What environment were you using?

OS: iOS

Additional context

No response

khmyznikov commented 7 months ago

You can disable limitsNavigationsToAppBoundDomains, but you will lose service worker. Better approach is to navigate for payment to external Safari.

rajandimri commented 7 months ago

Thanks, @khmyznikov for the suggestion. I don't know much about iOS. Would you mind telling me on - how can I enable the option to let the users pay using the external safari? Where and what changes I can do to achieve this?

Thanks!

khmyznikov commented 7 months ago

@rajandimri you need to have universal link setup for your iOS wrap, then don't use payment domains in lists and use payment redirect. This process will open the payment in Safari and should redirect back to your app via universal link.

jgw96 commented 7 months ago

Hey @rajandimri ! I am going to close this issue for now, but for help with the implementation of what @khmyznikov is saying, Id try our Discord https://aka.ms/pwabuilderdiscord