From 6c09b70317743d00542bb6ad7c282c66585691de Mon Sep 17 00:00:00 2001 From: southseact-3d Date: Thu, 12 Feb 2026 19:06:17 +0000 Subject: [PATCH] fix: improve plan change UX with card charge confirmation and fix paid-to-free downgrade --- chat/public/settings.html | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/chat/public/settings.html b/chat/public/settings.html index 664f6c8..6edd97d 100644 --- a/chat/public/settings.html +++ b/chat/public/settings.html @@ -1347,8 +1347,8 @@ showConfirmModal({ title: 'Change Subscription Plan', body: isDowngrade - ? `You are downgrading from ${currentLabel} to ${planLabel}. Any price difference will be credited to your account and applied to future renewals. Your subscription will continue without interruption.` - : `You are upgrading from ${currentLabel} to ${planLabel}. You will be charged the difference for the current billing period. Your subscription will update immediately.`, + ? `Your card will be charged for any price difference.

You are downgrading from ${currentLabel} to ${planLabel}. Any price difference will be credited to your account and applied to future renewals. Your subscription will continue without interruption.` + : `Your card will be charged for the price difference.

You are upgrading from ${currentLabel} to ${planLabel}. You will be charged the difference for the current billing period. Your subscription will update immediately.`, icon: 'info', onConfirm: async () => { setStatus('Changing subscription plan...'); @@ -1381,7 +1381,7 @@ return; } - // Handle paid-to-free downgrade (schedule cancellation at period end) + // Handle paid-to-free downgrade (use same cancel endpoint as cancel button) if (isPaidToFree) { const renewsAt = account?.subscriptionRenewsAt; const dateStr = renewsAt ? new Date(renewsAt).toLocaleDateString(undefined, { year: 'numeric', month: 'long', day: 'numeric' }) : 'the end of your billing period'; @@ -1393,19 +1393,13 @@ onConfirm: async () => { setStatus('Scheduling cancellation...'); try { - const resp = await fetch('/api/account', { + const resp = await fetch('/api/subscription/cancel', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-CSRF-Token': csrfToken, }, credentials: 'same-origin', - body: JSON.stringify({ - plan: newPlan, - billingCycle: newBillingCycle, - currency: newCurrency, - billingEmail: newBillingEmail, - }), }); const data = await resp.json().catch(() => ({}));