Skip to content

feat(billing): Stripe Customer Portal access + billing address/VAT collection at checkout - #524

Merged
gkhngyk merged 1 commit into
mainfrom
feature/stripe-billing-portal
Jul 23, 2026
Merged

gkhngyk merged 1 commit into
mainfrom
feature/stripe-billing-portal

Conversation

@gkhngyk

@gkhngyk gkhngyk commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

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:

  • New POST /api/stripe/portal — creates a Stripe Customer Portal session for the org's stripe_customer_id and returns its URL (return_url comes back to Settings → Billing). Returns 400 when the org has no Stripe customer yet.
  • "Manage Billing" button in Settings → Billing, on the same row as Cancel Subscription (right-aligned). Opens the portal via the new route; shown in both normal and cancel-scheduled states. Errors surface as a toast.
  • Checkout now collects billing details up front: billing_address_collection: 'required' + tax_id_collection: { enabled: true }, with customer_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/subscription so prompt-engine alignment isn't bypassed.

Related issue

—

Type of change

  • feat — New feature
  • fix — Bug fix
  • chore — Maintenance / dependencies
  • docs — Documentation only
  • refactor — Code change that neither fixes a bug nor adds a feature
  • test — Adding or updating tests

How to test

  1. In Settings → Billing, click Manage Billing — you should land on the Stripe Customer Portal and see payment method, billing address and tax ID sections (after the one-time portal configuration is saved in the Stripe Dashboard).
  2. Update the billing address in the portal and return — the invoice data in Stripe reflects the change.
  3. Cancel-scheduled state: schedule a cancellation and confirm the Manage Billing button is still available next to the reactivate banner.
  4. Fresh checkout: start a new subscription and confirm the address form and tax ID field appear on the Stripe checkout page.

Checklist

  • Branch follows the naming convention (feature/, fix/, chore/, docs/) — see CONTRIBUTING.md
  • Commits follow Conventional Commits
  • yarn lint passes (run from web/)
  • yarn typecheck passes (run from web/)
  • yarn format:check passes (run from web/)
  • Changes are focused — one concern per PR

@gkhngyk
gkhngyk merged commit 5160460 into main Jul 23, 2026
4 checks passed
@gkhngyk
gkhngyk deleted the feature/stripe-billing-portal branch July 23, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant