feat(billing): scaffold dual Stripe account support (EE default) - #3219
Draft
riderx wants to merge 1 commit into
Draft
feat(billing): scaffold dual Stripe account support (EE default)#3219riderx wants to merge 1 commit into
riderx wants to merge 1 commit into
Conversation
Add billing_account on stripe_info, nullable US plan catalog columns, account-scoped Stripe client resolution, US webhook route, and tests. Existing orgs and new customers stay on EE until US secrets and flag are set.
Contributor
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
Contributor
Merging this PR will not alter performance
Comparing Footnotes
|
|
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.



Summary (AI generated)
billing_account(ee|us) onstripe_info, default/backfilleefor all existing rows.plans(stripe_id_us,price_m_id_us,price_y_id_us,credit_id_us) — left empty.stripe_billing_account.tswithgetStripe(c, account),resolveBillingAccount, andgetNewCustomersBillingAccount(defaults to EE; US only when US secrets exist).STRIPE_SECRET_KEY+STRIPE_WEBHOOK_SECRET; optionalSTRIPE_SECRET_KEY_US+STRIPE_WEBHOOK_SECRET_US(US client fails closed if missing)./triggers/stripe_event_uswebhook route; stampbilling_accountonprocessed_stripe_events(composite PK).billing_accountfromSTRIPE_NEW_CUSTOMERS_ACCOUNT(safe default EE).Motivation (AI generated)
Capgo will eventually bill new customers on a US Stripe account while existing customers remain on the Estonian account. This PR adds the data model, env wiring, and client routing scaffolding without routing live traffic to US.
Business Impact (AI generated)
Enables a future US billing cutover without migrating existing
cus_/sub_IDs. No customer-facing billing change in this PR: all orgs stay on EE until US secrets and operational flag flip (out of scope here).Test Plan (AI generated)
tests/stripe-billing-account.unit.test.ts— EE default, US fail-closed, US client whenbilling_account=us+ US keytests/stripe-redirects.unit.test.ts— checkout/portal/customer updates with EE-only secretstests/stripe-subscription-events.unit.test.ts,tests/stripe-revenue-movement.unit.test.ts,tests/plans-billing-history.unit.test.tsbun run typecheck:backend(pre-commit)Generated with AI
Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.