Payment Request API in Cordova

341 Views Asked by At

Has anyone been able to use Payment Request in a Cordova Android app? window.PaymentRequest() always return "undefined" although the installed Chrome browser is updated and the demo works great!

Example code:

if (window.PaymentRequest) {
    console.log("It Worked!"); // This is never called
} else {
    console.log("Opsie, no Payment Request enabled");
}

Note that I tested this in a freshly created Cordova project and it works great on the browser.

1

There are 1 best solutions below

0
agektmr On BEST ANSWER

Unfortunately the Payment Request API is currently prohibited to use inside WebViews which means it won't work in Cordova.

See compatibility table at the bottom on "Android WebView": https://developer.mozilla.org/docs/Web/API/Payment_Request_API