Skip to content

Instantly share code, notes, and snippets.

@PaulGuo
Forked from jeffcarp/apple-pay-demo.js
Created July 29, 2016 04:52
Show Gist options
  • Save PaulGuo/0d00baa5361722ecdba4d808ede6c980 to your computer and use it in GitHub Desktop.
Save PaulGuo/0d00baa5361722ecdba4d808ede6c980 to your computer and use it in GitHub Desktop.
var session
if (window.ApplePaySession) {
var merchantIdentifier = 'merchant.com.canine-clothing'
ApplePaySession.canMakePaymentsWithActiveCard(merchantIdentifier)
.then(function (canMakePayments) {
if (canMakePayments) {
showApplePayButtons()
}
});
}
var paymentRequest = {
currencyCode: 'USD',
countryCode: 'US',
total: {
label: 'Canine Clothing',
amount: '19.99'
},
supportedNetworks: ['amex', 'discover', 'masterCard', 'visa'],
merchantCapabilities: ['supports3DS'],
requiredShippingAddressFields: ['postalAddress']
};
$('.apple-pay-button').on('click', function () {
session = new ApplePaySession(1, paymentRequest)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment