- From: majaybabu <notifications@github.com>
- Date: Wed, 11 Apr 2018 22:30:27 +0000 (UTC)
- To: w3c/payment-handler <payment-handler@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
- Message-ID: <w3c/payment-handler/issues/286/380616304@github.com>
We have the below install() function for registration. These 2 console statements never get printed even after the SW is installed and activated. Is the SW not able to add the payment method ?
console.log('registration.scope is' + registration.scope);
console.log('enabledMethods is' + instrument.method);
`function install() {
console.log('installing');
navigator.serviceWorker.register('/secure/sw.js').then(() => {
return navigator.serviceWorker.ready;
}).then((registration) => {
if (!registration.paymentManager) {
console.log('No payment handler capability in this browser. Is chrome://flags/#service-worker-payment-apps enabled?');
return;
}
if (!registration.paymentManager.instruments) {
console.log('Payment handler is not fully implemented. Cannot set the instruments.');
return;
}
registration.paymentManager.instruments
.set('instrument-key', {
name: 'Chrome uses name and icon from the web app manifest',
enabledMethods: ['https://americanexpress-dev.aexp.com/pay3'],
method: 'https://americanexpress-dev.aexp.com/pay3',
})
.then(() => {
registration.paymentManager.instruments.get('instrument-key').then((instrument) => {
console.log('registration.scope is' + registration.scope);
console.log('enabledMethods is' + instrument.enabledMethods || instrument.method);
console.log('installed');
}).catch((error) => {
console.log('error is' + error);
});
})
.catch((error) => {
console.log('error is' + error);
});
})
.catch((error) => {
console.log('error is' + error);
});
}`
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/w3c/payment-handler/issues/286#issuecomment-380616304
Received on Wednesday, 11 April 2018 22:30:55 UTC