关于能否缩小Google Pay结账窗口宽度以显示Pay按钮的技术咨询
Hey there, let's tackle this tricky issue you're facing!
First off, you've got this exactly right: the Google Pay checkout window (pay.google.com) has a hard-enforced minimum width of 608px, and this is a rule set directly by Google—Stripe doesn't have control over modifying that window's dimensions since it's hosted entirely by Google. So unfortunately, there's no hidden configuration option you're missing to shrink that window below its required minimum width.
That said, there are a few practical workarounds you can implement to keep users from hitting this frustrating roadblock:
- Add a pre-check before launching checkout: Throw in a quick script check right before triggering the Google Pay flow. If the current browser viewport width is less than 608px, show a friendly inline alert or modal telling users they'll need to widen their browser window to complete payment. This sets clear expectations upfront instead of leaving them confused when the "Pay" button vanishes.
- Specify a wider initial popup size: While you can't override Google's minimum width, some Stripe checkout implementations let you define the initial popup dimensions when calling methods like
redirectToCheckout. Try setting awindowSizeparameter to at least 608px wide—some browsers might respect this and avoid opening a too-small window that cuts off the button. - Switch to the inline Google Pay element: Instead of using the popup flow, consider Stripe's inline Google Pay element that embeds directly into your page. This element is more layout-flexible; while it still has minimum width requirements, it can adapt better to smaller screens (or you can adjust your page's container to meet the needed minimum width, letting the element fit neatly within it).
Hopefully these options help you smooth out the checkout experience for users with narrower browser windows!
备注:内容来源于stack exchange,提问作者HumbleBeginnings

