GoogleChrome / samples

A repo containing samples tied to new functionality in each release of Google Chrome.
https://www.chromestatus.com/samples
Apache License 2.0
5.79k stars 2.38k forks source link

canMakePayment always return false #581

Closed cozohar closed 6 years ago

cozohar commented 6 years ago

Hi, I'm trying to understand why canMakePayment always return false although I have setup a card in the browser. (When testing locally it always return true).

I configured a Visa test card in Chrome 4111111111111111 and also a real mastercard. I'm attaching the browser console. Am I doing something wrong? Is there a problem maybe?

const methodData = [{
        supportedMethods: "basic-card",
        data: {
            supportedNetworks: ["mastercard","visa"],
            supportedTypes: ["debit", "credit"]
        }
    }
];
const details = {
    total: {
        label: "Total due",
        amount: {currency: "USD", value: "10.00"}
    }
};
var request = new PaymentRequest(methodData, details);
PaymentRequest {id: "c12d264e-f677-49c8-b050-2252e38f5e24", shippingAddress: null, shippingOption: null, shippingType: null, onshippingaddresschange: null, …}
request.canMakePayment().then((result) => {
console.log(result);
});
Promise {<pending>}
__proto__: Promise
[[PromiseStatus]]: "resolved"
[[PromiseValue]]: undefined

false
cozohar commented 6 years ago

The problem was an invalid SSL certificate. I'm closing the issue.