Skip to content

Pass checkout locale to /checkout/start#826

Open
vkartaviy wants to merge 3 commits intomainfrom
feat/WEB-4004-locale-passthrough
Open

Pass checkout locale to /checkout/start#826
vkartaviy wants to merge 3 commits intomainfrom
feat/WEB-4004-locale-passthrough

Conversation

@vkartaviy
Copy link
Copy Markdown
Contributor

@vkartaviy vkartaviy commented Apr 1, 2026

Summary

Pass the resolved checkout locale through to both /checkout/start and /checkout/complete so Khepri can persist it for lifecycle email localization.

Linear: WEB-4004

Blocked by:

  • WEB-4005 (Khepri: accept locale in checkout schemas) — without this, Khepri rejects the field with error 7226 "Illegal parameters locale"

What changed

/checkout/start — Add locale?: string to:

  • CheckoutStartParams (purchase-operation-helper)
  • CheckoutStartRequestParams (backend)
  • PaddleStartCheckoutParams (paddle-service)

All 4 checkout flows now send selectedLocale as locale:

  • WebBilling (purchases-ui.svelte)
  • Stripe (stripe-checkout-purchases-ui.svelte)
  • Stripe Express (express-purchase-button.svelte)
  • Paddle (paddle-purchases-ui.svelte)

/checkout/complete — Add locale?: string to:

  • postCheckoutComplete (backend)
  • checkoutComplete (purchase-operation-helper)

Sent from 2 call sites:

  • WebBilling (payment-entry-page.svelte via $translator.selectedLocale)
  • Stripe Express (express-purchase-button.svelte via translator.selectedLocale)

This covers the checkout portal flow where locale is only known at completion time.

When no locale is set, the field is omitted from the request body (backward compatible).

Naming decisions

  • Public API: selectedLocale / defaultLocale (existing, unchanged)
  • Internal params + wire format: locale — matches Stripe/Paddle conventions and Khepri's schema
  • Future fields: timezone, localeSource, timezoneSource (documented in comments)
  • customerEmail keeps its prefix (ambiguous without it); locale doesn't need one

Verified locally

  • Ran webbilling-demo, triggered a purchase, confirmed locale appears in the /checkout/start request payload
  • Khepri returns error 7226 ("Illegal parameters locale") as expected — it doesn't accept the field yet (WEB-4005)

Test plan

  • 554 tests pass (7 new locale-specific tests)
  • Lint, prettier, eslint, typecheck, svelte-check all pass
  • Manual test: locale confirmed in request body via DevTools
  • E2E: deploy after WEB-4005 lands in Khepri

@vkartaviy vkartaviy marked this pull request as ready for review April 1, 2026 19:04
@vkartaviy vkartaviy requested review from nicfix and vicfergar April 1, 2026 19:04
@vkartaviy vkartaviy marked this pull request as draft April 1, 2026 19:13
@vkartaviy vkartaviy changed the title Pass checkout locale to /checkout/start (WEB-4004) Pass checkout locale to /checkout/start Apr 1, 2026
@vkartaviy vkartaviy marked this pull request as ready for review April 1, 2026 19:45
@vkartaviy
Copy link
Copy Markdown
Contributor Author

Related PRs for the email localization pipeline:

  • DB migration: wall-e#496 — adds locale column to rc_billing_subscriptions_data
  • Backend (Phase 2): khepri#19100 — accepts and persists locale (draft)

Base automatically changed from refactor/checkout-start-options-object to main April 2, 2026 20:47
Pass the resolved checkout locale through to /checkout/start so
backend systems can persist it for lifecycle email localization.

- Add locale field to CheckoutStartParams, CheckoutStartRequestParams,
  and PaddleStartCheckoutParams
- All 4 UI flows (WebBilling, Stripe, Stripe Express, Paddle) now
  send selectedLocale to the backend
- Locale is omitted from the request body when not set (backward compat)
@vkartaviy vkartaviy force-pushed the feat/WEB-4004-locale-passthrough branch from e4293da to 2c537d4 Compare April 2, 2026 20:50
@vkartaviy vkartaviy requested a review from a team April 7, 2026 21:01
Address review feedback from vicfergar:
- Send locale in /checkout/complete request body (same pattern as email)
- Add explicit locale test for StripeCheckoutPurchasesUi
- Add locale tests for postCheckoutComplete (include/omit)

The complete endpoint needs locale for the checkout portal flow where
locale is only known at completion time, not at start.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants