Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagejs
function onGooglePayLoaded() {
  const paymentsClient = getGooglePaymentsClient()
  paymentsClient.isReadyToPay(getGoogleIsReadyToPayRequest()) //device check
    .then(funtion(response) {
      If (response.result) {
      addGooglePayButton(); //button display
       prefetchGooglePaymentData();
       }
    })
    .catch(function(err) { //error processing
      console.error(err); //error output to the console
    })
}

To display the button, the script calls the addGooglePayButton function. In this case, you can customize the appearance of the Google Pay button. To do this, make changes to the createButton method: