Skip to content

feat(payment): PI-5215 [FE][Google Pay] Implement container mode in GooglePayPaymentStrategy#3247

Merged
bc-wpietrzak merged 5 commits into
masterfrom
PI-5215
May 18, 2026
Merged

feat(payment): PI-5215 [FE][Google Pay] Implement container mode in GooglePayPaymentStrategy#3247
bc-wpietrzak merged 5 commits into
masterfrom
PI-5215

Conversation

@bc-wpietrzak

@bc-wpietrzak bc-wpietrzak commented May 13, 2026

Copy link
Copy Markdown
Contributor

What/Why?

Add container mode support to the Google Pay payment strategy.
When container is 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-js part is still in progress. Both recordings in Testing section have experiment PI-5111.google_pay_direct_pay_on_click on, so stores with disabled experiment won't experience strange behaviour between closing of Google Pay modal and order confirmation.

Rollout/Rollback

Revert

Testing

When container value is provided:

Screen.Recording.2026-05-13.at.02.25.25.mov

When container value 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: when container is provided (instead of walletButton), 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 GooglePayPaymentInitializeOptions with container, button styling options (buttonColor, buttonSizeMode, buttonType), and an onInit(renderButton) hook to defer rendering until the container exists. Updates deinitialization and centralizes Google Pay widget error handling (including mapping CANCELED to PaymentMethodCancelledError), 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.

@bc-wpietrzak

Copy link
Copy Markdown
Contributor Author

cursor review

Comment thread packages/google-pay-integration/src/google-pay-payment-strategy.ts Outdated
@bc-wpietrzak

Copy link
Copy Markdown
Contributor Author

cursor review

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ 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
bc-wpietrzak marked this pull request as ready for review May 13, 2026 10:05
@bc-wpietrzak
bc-wpietrzak requested review from a team as code owners May 13, 2026 10:05
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;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[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;

Comment thread packages/google-pay-integration/src/google-pay-payment-strategy.ts Outdated
@bc-wpietrzak
bc-wpietrzak merged commit 81a6dbc into master May 18, 2026
9 checks passed
@bc-wpietrzak
bc-wpietrzak deleted the PI-5215 branch May 18, 2026 14:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants