Skip to main content
Available from Yuno Android SDK 2.24.0. Order breakdown, shipping address updates, and shipping method selector turn the Google Pay sheet into an express checkout:
  • 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.
Each capability is opt-in. If you don’t use them, your Google Pay integration works exactly as before.

Requirements

Upgrading to 2.24.0 is a breaking change.
  • Set minSdkVersion to 23 or higher. With 21 or 22 the build fails at the manifest merge step.
  • If your app pins com.google.android.gms:play-services-wallet below 20.0.0, remove the pin or use 20.0.0 or higher.
  • If you call startCheckout, startPayment, startPaymentLite, startPaymentSeamlessLite, or continuePayment passing every argument by position, update the call: a new optional parameter was added before the last callback. Calls that use named arguments or a trailing lambda need no change.
See the Android SDK changelog for details.

How it works

  1. Your backend adds summary_items and/or shipping_methods when it creates the checkout session.
  2. Your app registers onShippingAddressChanged when it starts the payment flow.
  3. 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.
  4. After the customer authorizes, the one-time token includes a shipping object with the selected method and the full address.
Two rules apply everywhere:
  • Every summary_items list must end with the grand total. Its amount is the total shown on the sheet, and its label is 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)

Add summary_items when you create the checkout session:
The sheet now shows an expandable breakdown with the total labeled “ACME Inc.” No app code is needed.
  • The ids subtotal, shipping, tax, and discount use 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). If it doesn’t, the sheet shows only the total.
  • Discounts can be negative, for example -5.00.
  • If the list is invalid (missing label or amount, mixed currencies, no total), the sheet shows only the total.
  • When you also send shipping_methods (Step 2), each method uses its own breakdown and this list is ignored.

Step 2: Offer shipping methods on the sheet

Add shipping_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:
The selector needs the handler from Step 3. Without it, the sheet ignores the methods and works as before.
  • 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”. detail is shown as the description.
  • Switching methods never calls your app or your backend. The total comes from that method’s summary_items.
  • Send at least one line plus the total in each method’s summary_items. 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 on Android does not display it.

Step 3: React to shipping address changes

Register onShippingAddressChanged when you start the flow:
The same optional parameter exists in 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 null. The full address arrives in the one-time token (Step 4).

What you return: ShippingUpdate

Call complete(...) with any combination of these, or with null to keep the sheet as it is:

Rules

An error on the sheet does not block the payment. The customer can still pay, and the token carries the address you rejected. Always validate the address on your server when you create the payment. If a sale must not happen, return no available shipping method for that address.

Step 4: Read the result in the one-time token

After the customer authorizes, the one-time token you receive in callbackOTT includes a shipping object with the full address and the selected method:
  • method is the one selected on the sheet, or the first one if the customer didn’t change it.
  • summary_items are not sent back.
  • If you don’t register a handler, the token doesn’t include shipping.
Use this object on your server to charge the final amount, validate the address, and ship the order.

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 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.

Testing checklist

  1. Upgrade to SDK 2.24.0, set minSdkVersion 23, and build.
  2. Create a session with summary_items only. The sheet shows the breakdown and the right total.
  3. Create a session with shipping_methods and register the handler. The sheet shows the selector with the first method selected.
  4. Switch methods. The price updates and your handler is not called.
  5. Change the address. Your handler receives it; return new totals and check the sheet updates.
  6. Return an error for an address you don’t serve. The sheet shows your message. Check that your server also rejects that address, because the customer can still pay.
  7. Authorize. The token includes shipping with the method and the full address.
  8. Remove the handler and the session fields. Everything works as before.

Troubleshooting