Skip to content

Instantly share code, notes, and snippets.

@martinschierle
Created July 16, 2018 07:21
Show Gist options
  • Save martinschierle/fc7716d6fcf8aba7a6ca3b96ffd0b040 to your computer and use it in GitHub Desktop.
Save martinschierle/fc7716d6fcf8aba7a6ca3b96ffd0b040 to your computer and use it in GitHub Desktop.
Small JS snippet to use via console to check gpay availability
var e = document.createElement("script");
e.src = "https://pay.google.com/gp/p/js/pay.js";
document.head.appendChild(e);
e.onload = function(){
var paymentsClient = new google.payments.api.PaymentsClient({environment: 'TEST'});
var allowedPaymentMethods = ['CARD', 'TOKENIZED_CARD'];
paymentsClient.isReadyToPay({allowedPaymentMethods: allowedPaymentMethods})
.then(function(response) {
if (response.result) {
console.log("isReadyToPay: " + response.result);
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment