cordovapayment-request-api

Payment Request API in Cordova


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.


Solution

  • 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