- Order breakdown: show subtotal, shipping, taxes, and discounts instead of a single total.
- Shipping address updates: recalculate the order when the customer picks or changes their shipping address, without leaving the sheet.
- Shipping method selector: let the customer choose Standard, Express, or Same-day on the sheet, with instant price updates.
Requirements
On the Web there are no breaking changes and no page changes: the SDK loads and configures Google Pay for you. If you load a fixed SDK version (for example, with an integrity hash), make sure it is 1.10.8 or newer.
How it works
- Your backend adds
summary_itemsand/orshipping_methodswhen it creates the checkout session. - Your app registers
onShippingAddressChangedwhen it starts the payment flow. - On the Google Pay sheet, switching shipping method updates the price instantly without calling your app. Picking or changing the shipping address calls your handler, so you can return new totals, new methods, or an error.
- After the customer authorizes, the one-time token includes a
shippingobject with the selected method and the full address.
- Every
summary_itemslist must end with the grand total. Itsamountis the total shown on the sheet, and itslabelis shown next to it (we recommend your store name). - All amounts must use the session currency. A different currency makes the SDK ignore that breakdown or response.
Step 1: Show an order breakdown (backend only)
Addsummary_items when you create the checkout session:
- The ids
subtotal,shipping,tax, anddiscountuse Google’s native line types. Any other id shows as a regular line. The customer only sees your labels. - The last entry must be the grand total and must match the session amount (tolerance 0.001 on Android, 0.01 on Web). If it doesn’t, the sheet shows only the total.
- Discounts can be negative, for example
-5.00. - Send at least two entries: one line plus the grand total. If the list is invalid (fewer than two entries, missing label or amount, mixed currencies, no total), the sheet shows only the total. Nothing breaks and the customer sees no error.
- Without a breakdown, the Web SDK labels the amount “Total” in the checkout language (SDK 1.11.17 or newer).
- When you also send
shipping_methods(Step 2) and register the handler, the sheet shows the first method’s breakdown and this list is ignored.
Step 2: Offer shipping methods on the sheet
Addshipping_methods to the checkout session. Each method has its own summary_items, so the sheet can update the price as soon as the customer switches method:
- Every method needs a unique id. If two methods share an id, the selector is not shown.
- The first method is preselected.
- The price is shown in the option name, for example “$5.00: Standard shipping”.
detailis shown as the description. - Switching methods never calls your app or your backend. The total comes from that method’s
summary_items. - Each method’s
summary_itemsmust end with that method’s total, which can differ from the session amount. Send at least one line plus the total. A method with only the total shows no breakdown and Google’s default total label. - If any method is invalid, the selector is not shown.
delivery_estimate({ "from": "YYYY-MM-DD", "to": "YYYY-MM-DD" }) is accepted, but Google Pay does not display it on Android or on the Web.
Step 3: React to shipping address changes
RegisteronShippingAddressChanged when you start the flow. Your handler receives the redacted address and answers with new totals, new methods, an error, or nothing to keep the sheet as it is.
- Android
- Web
startPayment, startPaymentLite, startPaymentSeamlessLite, and continuePayment. Register it every time you start a flow.What you receive: ShippingInfo
Before authorization, Google shares only part of the address, which is enough to quote shipping and taxes:
Every field can be missing:
null on Android, absent on the Web. The full address arrives in the one-time token (Step 4).
What you return: ShippingUpdate
Answer with any combination of these, or withnull to keep the sheet as it is. On Android call complete(...); on the Web return the value from the handler.
- Android
- Web
Rules
To change prices while the selector is shown, return the full
shippingMethods list, each method with its own summaryItems. If you return only summaryItems, the total changes, but the next time the customer switches method the sheet goes back to that method’s original breakdown.
Step 4: Read the result in the one-time token
After the customer authorizes, the one-time token you receive incallbackOTT (Android) or createPayment (Web) includes a shipping object with the full address and the selected method:
methodis the one selected on the sheet, or the first one if the customer didn’t change it. Its label is the one you sent, without the price.- Empty address fields come back as empty strings on Android and are left out on the Web.
summary_itemsare not sent back.- If you don’t register a handler, the token doesn’t include
shipping.
What happens in each case
Good to know
- The addresses belong to the customer’s Google account. In Google Pay’s TEST environment you’ll only see Google’s test addresses; you can’t add your own.
- The sheet asks for a shipping address as soon as the handler is registered. Without a handler, it only asks when the shipping address is enabled as a required field in the Checkout Builder.
- The selected method stays selected when the customer changes the address, unless you return new methods.
- Privacy: the SDK never logs addresses, emails, or payment data.
- Google Pay Pix (Brazil) is not affected.