feat(payment): PI-5215 [FE][Google Pay] Implement container mode in GooglePayPaymentStrategy#3247
Merged
Conversation
…ooglePayPaymentStrategy
…ooglePayPaymentStrategy
…ooglePayPaymentStrategy
Contributor
Author
|
cursor review |
…ooglePayPaymentStrategy
Contributor
Author
|
cursor review |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit e6f79c5. Configure here.
bc-wpietrzak
marked this pull request as ready for review
May 13, 2026 10:05
PavlenkoM
reviewed
May 14, 2026
Comment on lines
+185
to
+195
| protected _addPaymentButtonToContainer( | ||
| containerId: string, | ||
| buttonColor: GooglePayPaymentInitializeOptions['buttonColor'], | ||
| buttonSizeMode: GooglePayPaymentInitializeOptions['buttonSizeMode'], | ||
| buttonType: GooglePayPaymentInitializeOptions['buttonType'], | ||
| onError: GooglePayPaymentInitializeOptions['onError'], | ||
| ): void { | ||
| if (this._paymentButton) { | ||
| return; | ||
| } | ||
|
|
Contributor
There was a problem hiding this comment.
[optional]
Suggested change
| protected _addPaymentButtonToContainer( | |
| containerId: string, | |
| buttonColor: GooglePayPaymentInitializeOptions['buttonColor'], | |
| buttonSizeMode: GooglePayPaymentInitializeOptions['buttonSizeMode'], | |
| buttonType: GooglePayPaymentInitializeOptions['buttonType'], | |
| onError: GooglePayPaymentInitializeOptions['onError'], | |
| ): void { | |
| if (this._paymentButton) { | |
| return; | |
| } | |
| protected _addPaymentButtonToContainer( | |
| googlePayOptions: GooglePayPaymentInitializeOptions, | |
| ): void { | |
| if (this._paymentButton) { | |
| return; | |
| } | |
| const { | |
| walletButton, | |
| loadingContainerId, | |
| container, | |
| buttonColor, | |
| buttonSizeMode, | |
| buttonType, | |
| onInit, | |
| ...callbacks | |
| } = googlePayOptions; | |
…ooglePayPaymentStrategy
PavlenkoM
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What/Why?
Add container mode support to the Google Pay payment strategy.
When
containeris provided (instead of walletButton), a Google Pay button is rendered inside the target element, in place of the Place Order button.Note: this PR only contains changes related to rendering Google Pay button in the SDK;
checkout-jspart is still in progress. Both recordings in Testing section have experimentPI-5111.google_pay_direct_pay_on_clickon, so stores with disabled experiment won't experience strange behaviour between closing of Google Pay modal and order confirmation.Rollout/Rollback
Revert
Testing
When
containervalue is provided:Screen.Recording.2026-05-13.at.02.25.25.mov
When
containervalue is not provided (defaults to using current implementation,walletButton):Screen.Recording.2026-05-13.at.02.30.17.mov
Note
Medium Risk
Changes Google Pay checkout entrypoint by supporting a new container-rendered button and direct-pay flow, affecting initialization, click handling, and teardown paths. Risk is moderate due to new UI/DOM integration and error-handling paths that can impact conversion if misconfigured.
Overview
Adds an alternative container mode to
GooglePayPaymentStrategy: whencontaineris provided (instead ofwalletButton), the strategy renders a branded Google Pay button into the target element and uses that button to launch the payment sheet and proceed with the direct-pay checkout flow.Extends
GooglePayPaymentInitializeOptionswithcontainer, button styling options (buttonColor,buttonSizeMode,buttonType), and anonInit(renderButton)hook to defer rendering until the container exists. Updates deinitialization and centralizes Google Pay widget error handling (including mappingCANCELEDtoPaymentMethodCancelledError), with comprehensive new unit coverage for container initialization, click behavior, and cleanup.Reviewed by Cursor Bugbot for commit 35133aa. Bugbot is set up for automated code reviews on this repo. Configure here.