[WEB-4304] fix: Force billing address collection in Express Checkout element#891
Conversation
📝 WalkthroughWalkthroughStripeService now always sets billingAddressRequired: true; UI components remove the ChangesRemove billingAddressRequired from checkout
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
befdc6a to
5ab4952
Compare
5ab4952 to
76ab7a2
Compare
There was a problem hiding this comment.
Actionable comments posted: 0
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/stripe/stripe-service.ts (1)
280-292:⚠️ Potential issue | 🟠 Major | ⚡ Quick win
billingAddressRequiredis still overrideable by caller options.Line 291 can overwrite Line 281, so this doesn’t truly force billing address collection. Make
billingAddressRequired: truethe last-assigned property (or strip it fromexpressCheckoutOptions) so callers can’t disable it.Suggested fix
- const options = { - billingAddressRequired: true, - emailRequired: true, - ...(forceEnableWalletMethods - ? { - paymentMethods: { - applePay: "always", - googlePay: "always", - }, - } - : {}), - ...(expressCheckoutOptions ? expressCheckoutOptions : {}), - } as StripeExpressCheckoutElementOptions; + const options = { + emailRequired: true, + ...(forceEnableWalletMethods + ? { + paymentMethods: { + applePay: "always", + googlePay: "always", + }, + } + : {}), + ...(expressCheckoutOptions ? expressCheckoutOptions : {}), + billingAddressRequired: true, + } as StripeExpressCheckoutElementOptions;🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/stripe/stripe-service.ts` around lines 280 - 292, The options object currently sets billingAddressRequired: true but then spreads expressCheckoutOptions afterwards, allowing callers to override it; update the construction of options (the variable named options in stripe-service.ts) so billingAddressRequired: true is applied after spreading expressCheckoutOptions (or remove billingAddressRequired from expressCheckoutOptions before the spread) to ensure billingAddressRequired cannot be disabled by callers; keep the existing forceEnableWalletMethods handling intact so only billingAddressRequired is enforced last.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/stripe/stripe-service.ts`:
- Around line 280-292: The options object currently sets billingAddressRequired:
true but then spreads expressCheckoutOptions afterwards, allowing callers to
override it; update the construction of options (the variable named options in
stripe-service.ts) so billingAddressRequired: true is applied after spreading
expressCheckoutOptions (or remove billingAddressRequired from
expressCheckoutOptions before the spread) to ensure billingAddressRequired
cannot be disabled by callers; keep the existing forceEnableWalletMethods
handling intact so only billingAddressRequired is enforced last.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: c72ea90e-c82f-4dc5-8317-1babb6842293
📒 Files selected for processing (5)
src/stripe/stripe-service.tssrc/ui/express-purchase-button/express-purchase-button.sveltesrc/ui/molecules/stripe-elements.sveltesrc/ui/molecules/stripe-express-checkout-element.sveltesrc/ui/pages/payment-entry-page.svelte
💤 Files with no reviewable changes (4)
- src/ui/molecules/stripe-elements.svelte
- src/ui/molecules/stripe-express-checkout-element.svelte
- src/ui/express-purchase-button/express-purchase-button.svelte
- src/ui/pages/payment-entry-page.svelte
**This is an automatic release.** ## RevenueCat SDK ### ✨ New Features * Add presented offering context to paywall events (#818) via Rick (@rickvdl) ### 🐞 Bugfixes * [WEB-4304] fix: Force billing address collection in Express Checkout element (#891) via Víctor Ferrer García (@vicfergar) ### 🔄 Other Changes * Bump jwt from 2.10.2 to 2.10.3 (#895) via dependabot[bot] (@dependabot[bot])
Motivation / Description
We want to always collect the billing address in the Express Checkout element, regardless of whether tax collection is currently enabled for the merchant. The reasoning:
Previously,
billingAddressRequiredwas wired through the component chain and toggled based ontaxCalculationStatus/brandingInfo.gateway_tax_collection_enabled. That meant merchants with tax collection disabled at render time would not get a billing address, even if it later became relevant.Changes introduced
billingAddressRequiredprop from the component chain so the Express Checkout element always requests the billing address:payment-entry-page.svelte: no longer computes/passesbillingAddressRequired={taxCalculationStatus !== "disabled"}.express-purchase-button.svelte: no longer passesbillingAddressRequired={brandingInfo?.gateway_tax_collection_enabled}.stripe-elements.svelteandstripe-express-checkout-element.svelte: drop the prop and stop forwarding it toStripeService.createExpressCheckoutElement.Linear ticket (if any)
WEB-4304
Additional comments
billingAddressRequiredis on vs. off.Summary by CodeRabbit