I am trying to run an example of the Payment request API as shown on https://www.youtube.com/watch?v=yelPlCVZLEE . I have followed the process as they describe and i Have also run the following code:
function go() {
console.log('Pay');
var request = new PaymentRequest([{
supportedMethods:['urn:payment:visa','urn:payment:mc','urn:payment:amex']
}],
{
total: {
label: "Total due",
amount: { currencyCode: "USD", value: "60.00" }, // US$60.00
}
}
);
request.show()
.then(function(response) {
// process transaction response here
return response.complete(true);
})
.then(function() {
alert("Buy!");
})
.catch(function(e) {
alert(e.name);
});
}
and I get the following error: Uncaught ReferenceError: PaymentRequest is not defined.
If I run the test from : http://github.adrianba.net/paymentrequest-demo/tests/payment-tests.html It's says it's defined. What I am doing wrong?