Created
July 1, 2019 12:30
-
-
Save indreklasn/36c7f135d03e6a1c05e7172e67e1e6f4 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
buyButton.addEventListener('click', () => { | |
const request = new PaymentRequest(buildSupportedPaymentMethodData(), buildShoppingCartDetails()); | |
request.canMakePayment().then(result => { | |
if (result) { | |
request.show().then(paymentResponse => { | |
console.log(paymentResponse.details) | |
// Here we would process the payment. For this demo, simulate immediate success: | |
paymentResponse.complete('success') | |
.then(() => thankYouMessage.style.opacity = 1) | |
}) | |
} | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment