Jun 28 - Fix bill.stripe.com returns incorrectly

This commit is contained in:
2026-06-28 18:33:14 -04:00
parent 3d031a2ddf
commit 9295f9fa9d
+5 -2
View File
@@ -105,7 +105,8 @@ def subscribe():
price_id = plan.stripe_price_id price_id = plan.stripe_price_id
# Create Checkout Session AFTER the control_session commits customer_id. # Create Checkout Session AFTER the control_session commits customer_id.
base_url = (current_app.config.get('APP_BASE_URL') or request.host_url).rstrip('/') # Use request.host_url so success/cancel redirect back to the tenant's domain.
base_url = request.host_url.rstrip('/')
try: try:
session = create_checkout_session( session = create_checkout_session(
customer_id=stripe_customer_id, customer_id=stripe_customer_id,
@@ -147,7 +148,9 @@ def portal():
return redirect(url_for('tenant_settings.plan')) return redirect(url_for('tenant_settings.plan'))
stripe_customer_id = t.stripe_customer_id stripe_customer_id = t.stripe_customer_id
base_url = (current_app.config.get('APP_BASE_URL') or request.host_url).rstrip('/') # Use the actual request host so the return URL matches the tenant's domain,
# not the global APP_BASE_URL which points to the primary domain.
base_url = request.host_url.rstrip('/')
return_url = f'{base_url}/settings/plan' return_url = f'{base_url}/settings/plan'
try: try: