Repository navigation
feat(billing): Stripe Customer Portal access + billing address/VAT collection at checkout - #524
Merged
Merged
Conversation
…address at checkout
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
Users currently have no way to update their payment method, billing address or VAT/tax ID — none of these are editable anywhere in the app, and checkout never collected them in the first place. A customer with an expired card or a missing VAT number on invoices is stuck.
This PR closes that gap in two small pieces:
POST /api/stripe/portal— creates a Stripe Customer Portal session for the org'sstripe_customer_idand returns its URL (return_urlcomes back toSettings → Billing). Returns 400 when the org has no Stripe customer yet.billing_address_collection: 'required'+tax_id_collection: { enabled: true }, withcustomer_update: { address: 'auto', name: 'auto' }(required by Stripe when reusing an existing customer so the collected fields are written back).Ops note (one-time): the Customer Portal needs a saved default configuration in the Stripe Dashboard (Settings → Billing → Customer portal) before the API works in live mode. Recommended config: payment method / billing address / tax ID updates on, plan switching and cancellation off — plan changes must keep flowing through our own
PATCH /api/stripe/subscriptionso prompt-engine alignment isn't bypassed.Related issue
—
Type of change
feat— New featurefix— Bug fixchore— Maintenance / dependenciesdocs— Documentation onlyrefactor— Code change that neither fixes a bug nor adds a featuretest— Adding or updating testsHow to test
Checklist
feature/,fix/,chore/,docs/) — see CONTRIBUTING.mdyarn lintpasses (run fromweb/)yarn typecheckpasses (run fromweb/)yarn format:checkpasses (run fromweb/)