google-pay / google-pay/flutter-plugin

Google Pay button doesn't update the amount on Android

Open
#323 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Dart
Stars
176
Forks
147
PR merge metrics
No merged PRs in 30d

Description

Issue description

GooglePayButton does not update when the payment amount or payment items change after the widget has been built.

Even if the widget rebuilds due to state updates (setState, Bloc, Provider, etc.), the button continues using the initial amount configuration. The updated payment data is not reflected when the Google Pay sheet opens.

The only workaround is to completely remove the widget from the tree and add it again. This suggests the underlying platform view is initialized once and not reconfigured on rebuild. This makes the widget hard to use in dynamic checkout flows where totals change (shipping, discounts, taxes, quantity updates, etc.).

Expected behavior

After a state change and widget rebuild, the Google Pay sheet should display the latest payment amount and items, not the original values.

Reference

paymentItems is not reactive

Flutter doctor output

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.35.7, on macOS 15.1 24B83 darwin-arm64, locale en-US)
[!] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
✗ cmdline-tools component is missing.
Try installing or updating Android Studio.
Alternatively, download the tools from https://developer.android.com/studio#command-line-tools-only and make sure to set the ANDROID_HOME environment variable.
See https://developer.android.com/studio/command-line for more details.
✗ Android license status unknown.
Run flutter doctor --android-licenses to accept the SDK licenses.
See https://flutter.dev/to/macos-android-setup for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 16.2)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2025.2)
[✓] VS Code (version 1.98.2)
[✓] Connected device (3 available)
[✓] Network resources

Recording

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at GooglePayButton and trace how its Android platform view receives the payment amount and items across widget rebuilds; reproduce the issue with a changing checkout total. Done means the Google Pay sheet displays the latest payment amount and items after state-driven rebuilds without removing the widget from the tree.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, dart, flutter
Domain
mobile, payments
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.