Payment Request API が使用可能なブラウザか調べる方法

if(window.PaymentReqeust) {

  console.log("support")

} else {

  console.log("not support")

}

 

ただし、payment Request API が使用可能でかつ、クレジット情報が既にブラウザに保存済みか調べるためにはpaymentRequestオブジェクトを生成したのち、canMakePayment()を使用しないと確認できない。

 

f:id:monteecristoo:20201223212158p:plain

ref:

https://developer.mozilla.org/ja/docs/Web/API/Payment_Request_API/Using_the_Payment_Request_API