Stay organized with collections
Save and categorize content based on your preferences.
This page contains live Google Pay demos that you can edit in JavaScript or JSFiddle.
Basic example
The following demonstrates a basic example of the Google Pay button in action. Refer to the
adjacent code for an example on how it's constructed.
Button resize example
The following demonstrates how you can resize the Google Pay button. Call
createButton with the buttonSizeMode property set to fill,
and then set a size on the #container div.
Authorize Payments example
The following is an example of how you can authorize a payment before processing it.
The reason you might want to authorize a payment before processing it is to give the user an
opportunity to choose a different payment method if the authorization fails.
You can handle the payment authorization request by following these instructions:
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[[["This page provides live, editable Google Pay demos using JavaScript or JSFiddle."],["You can explore examples demonstrating basic Google Pay button integration, button resizing, and payment authorization."],["The demos also showcase how to dynamically update prices based on shipping changes using Dynamic Price Updates."],["These demos are interactive and can be edited in JSFiddle for experimentation and learning."]]],["The content showcases live Google Pay demos editable in JavaScript or JSFiddle. Key actions include creating and resizing the Google Pay button using `createButton` with `buttonSizeMode`. It demonstrates authorizing payments before processing by registering `onPaymentAuthorized()`, calling `loadPaymentData()`, and implementing the callback handler. Dynamic price updates are enabled by registering `onPaymentAuthorized` and `onPaymentDataChanged`, and implementing both functions after calling `loadPaymentData`. Note that authorize payments and Dynamic price updates do not support liability shift.\n"]]