Skip to content

Instantly share code, notes, and snippets.

@thangman22
Created August 12, 2016 16:08
Show Gist options
  • Save thangman22/7a0a5747f804df715b18dcc5895c1975 to your computer and use it in GitHub Desktop.
Save thangman22/7a0a5747f804df715b18dcc5895c1975 to your computer and use it in GitHub Desktop.
function onBuyClicked() {
var supportedInstruments = [{
supportedMethods: ['amex', 'diners', 'discover', 'jcb', 'mastercard',
'unionpay', 'visa']
}];
var details = {
total: {label: 'Donation', amount: {currency: 'USD', value: '55.00'}},
displayItems: [
{
label: 'Original donation amount',
amount: {currency: 'USD', value: '65.00'}
},
{
label: 'Friends and family discount',
amount: {currency: 'USD', value: '-10.00'}
}
]
};
new PaymentRequest(supportedInstruments, details) // eslint-disable-line no-undef
.show()
.then(function(instrumentResponse) {
sendPaymentToServer(instrumentResponse);
})
.catch(function(err) {
ChromeSamples.setStatus(err);
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment