Versions Compared

Key

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

...

For more information on adding a button, see the Google Pay API documentation https://developers.google.com/pay/api/web/reference/object?hl=ru#ButtonOptions.

An example of the addGooglePayButton function that adds a large black button:

Code Block
languagejs
function addGooglePayButton() {
  const paymentsClient = getGooglePaymentsClient();
  const button =
     paymentsClient.createButton({onClick: onGooglePaymentButtonClicked, buttonColor:'black', buttonType:'long'}); //button creation
        document.getElementById('container').appendChild(button); // adding a button to a page
        document.getElementById('container').style.display = 'block';
}