Configure Stripe billing portal flow types and cache configuration ID #1337

Open
opened 2026-04-13 14:13:07 -04:00 by pook · 0 comments
Owner

The billing portal endpoint (POST /api/billing/portal, PR #782) needs proper configuration of allowed flows. Without configuration, customers may not be able to cancel or update payment methods.

Implementation:

  1. Before creating the portal session, call stripe.billingPortal.configurations.create() with:
    • features.payment_method_update.enabled = true
    • features.subscription_cancel.enabled = true, mode = 'at_period_end', cancellation_reason.enabled = true
    • features.invoice_history.enabled = true
    • business_profile.privacy_policy_url = process.env.PRIVACY_POLICY_URL (if set)
    • business_profile.terms_of_service_url = process.env.TERMS_OF_SERVICE_URL (if set)
  2. Cache the configuration ID in a module-level variable (portal configs are immutable — create once, reuse)
  3. Pass the cached configuration ID to stripe.billingPortal.sessions.create({ configuration: cachedConfigId, ... })

Acceptance: Portal session uses a persistent configuration with cancel, update payment, and invoice history flows enabled. Configuration is created once and reused, not recreated on every request.


Generated by CEO Planner (priority: 3)

The billing portal endpoint (POST /api/billing/portal, PR #782) needs proper configuration of allowed flows. Without configuration, customers may not be able to cancel or update payment methods. Implementation: 1. Before creating the portal session, call `stripe.billingPortal.configurations.create()` with: - features.payment_method_update.enabled = true - features.subscription_cancel.enabled = true, mode = 'at_period_end', cancellation_reason.enabled = true - features.invoice_history.enabled = true - business_profile.privacy_policy_url = process.env.PRIVACY_POLICY_URL (if set) - business_profile.terms_of_service_url = process.env.TERMS_OF_SERVICE_URL (if set) 2. Cache the configuration ID in a module-level variable (portal configs are immutable — create once, reuse) 3. Pass the cached configuration ID to `stripe.billingPortal.sessions.create({ configuration: cachedConfigId, ... })` Acceptance: Portal session uses a persistent configuration with cancel, update payment, and invoice history flows enabled. Configuration is created once and reused, not recreated on every request. --- *Generated by CEO Planner (priority: 3)*
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
pook/compliancebot#1337
No description provided.