https://www.youtube.com/watch?v=yelPlCVZLEEのようにPayment request APIの例を実行しようとしています。彼らが説明するよう 私は、プロセスを踏襲していると私はまた、次のコードを実行した:PaymentRequest APIが定義されていません
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);
});
}
を、私は次のエラーを取得:キャッチされないにReferenceError:PaymentRequestが定義されていませんが。
テストを実行した場合: http://github.adrianba.net/paymentrequest-demo/tests/payment-tests.html それは定義されています。 私は間違っていますか?
<script src="../lib/paymentrequest.js"></script>
PaymentRequest
の独自の実装を定義しています:
ありがとうございました。私はそれをやったが、今は、https://www.w3.org/TR/payment-request/の手順を踏んで、APIを呼び出すことで働いた。 –
ありがとう!私は '#web-payments'フラグを有効にしなければならないと思っていましたが、そうではありません!乾杯:) –