Created
August 12, 2016 16:08
-
-
Save thangman22/7a0a5747f804df715b18dcc5895c1975 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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