Error while using react-native-webview when rendering Web Payments SDK

In my use case, we need to use the provided Web Payments SDK inside a webview in our React-native app. We can’t use the IAP.

In a modern browser, like an up-to-date Chrome or Mozilla Firefox, it works fine, I can past the URL and it loads everything. However, when I open my URL inside a react-native-webview, it errors saying:

Uncaught SyntaxError: Unexpected token ?

It seems to be in this function the issue:

const o = r.retryOnTimeout ?? !0,

I don’t know if is the fact that it is minified and there is no space that is causing the issue, or might be something related to my webview.

Could you give me some thought on how to fix this?

Is there a specific reason you can’t use In-App Payments? If it’s working on other browsers I imagine the webview is somehow malforming something. :slightly_smiling_face:

As it is an “outside of AppStore” service we provide, we can’t use In-App Payments per Apple’s terms.

I will fiddle with the webview a bit more. What would be the browser compatibility of the SDK? This would give me a better idea of what could be the issue, as my webview implementation is slightly behind in terms of features.

Okay, but even if its a webview in your app as I understand it it’s still an in app purchase. :slightly_smiling_face:

Hey Bryan, thanks for your support. As this is a legacy app, I pinpoint the issue to the nullish coalescing operator ?? that is not recognized by the webview. Our current webview version does not support it, as it started being supported in version 80+ on Android and 13.4 on Safari. Updating the webview is on the way, but as a quick-fix, we will redirect the user to their device’s browser, which should be up-to-date and will fix the issue temporarily.

Hope this helps someone else having a similar issue.

That’s awesome your figured it out. Thanks for sharing your findings with the community. :slightly_smiling_face: