Can Apple Pay (JS) be used from within a WKWebView?

A native iOS/Swift app I'm working on incorporates a WebView to process order transactions (of physical product/service, not a digital product).


The native app currently has no role in submitting the product order or collecting payment.


The client would like to use ApplePay as a payment method, and the logical thing to do is to add the ApplePay JS library and web pay button into the webview transaction.


However when this is attempted, the page in the webview doesn't work correctly. When the page is launched in Safari.app (not in WebView) it works fine. However when the same page from the same webserver is placed in a WKWebView, the web developers see problems, such as:


-- Trying to start an Apple Pay session from a document with an different security origin than its top-level frame

-- "Browser doesn't support apple pay" (I think they generate this error based on doing the web-based Apple Pay presence check)


Before digging into this too far, I was trying to determine if we're just running into a "you can't do that" type of issue, but haven't located a specific support statement re: WKWebView embedding. Is it known whether web-bases Apple Pay (not native sdk) is permitted within a WKWebView?


Thanks for any guidance!

Replies

I presume you've seen this 2017 SO thread...


https://stackoverflow.com/questions/44190343/applepay-on-wkwebview


I think, tho, that the answer is yes - you can't get there from here.