如果我想知道设备是否支持paymentrequest api中的supportedMethods,怎么办?
我可以使用canMakePayment
如果该设备的付款请求支持三星支付,我试图显示三星支付按钮
请您指导
var supportedInstruments = [{
supportedMethods:'https://spay.samsung.com',
data: {
"version": "1",
"productId": "123", //Service id from partner portal
"allowedCardNetworks": ['mastercard', 'visa'],
"orderNumber": "1233123",
"merchantName": "1800FLOWERS.COM", //Merchant name in partner portal
"merchantGatewayParameter": {
"userId": "123"
},
},
"isRecurring": false,
"billingAddressRequired": false,
"paymentProtocol": "PROTOCOL_3DS"
}];
var request = new PaymentRequest(supportedInstruments, details, options);
if (request.canMakePayment) {
paymentRequest.canMakePayment().then(function (result) {
if (result) {
console.log('res');
resolve(true);
// User has an active payment method
} else {
console.log('res1');
reject(false);
// No active payment method yet (but they could add one)
}
}).catch(function (error) {
console.log('res2');
reject(false);
// Unable to determine
});
}
});