Skip to content

Commit 5a7e5b2

Browse files
committed
Update free plan cancellation to use billing portal
Replaces the cancellation action with a 'manage' action when switching to the free plan, directing users to the billing portal for subscription management. This provides a more consistent and user-driven cancellation experience.
1 parent 763736d commit 5a7e5b2

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/pages/Pricing.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,12 @@ export default function Pricing() {
271271
? role.stripe_price_id_yearly
272272
: role.stripe_price_id_monthly;
273273

274-
// If switching to free plan, handle cancellation
274+
// If switching to free plan, send user to billing portal to manage cancellation
275275
if (!role.price_monthly || role.price_monthly === 0) {
276276
const { data: result, error: invokeError } = await supabase
277277
.functions.invoke('create-smart-session', {
278278
body: {
279-
action: 'cancel',
279+
action: 'manage',
280280
cancel_url: `${window.location.origin}/pricing`
281281
}
282282
});
@@ -355,11 +355,11 @@ export default function Pricing() {
355355
return;
356356
}
357357

358-
// Use smart session to handle cancellation
358+
// Open billing portal so the user can manage their cancellation
359359
const { data: sessionData, error: sessionError } = await supabase
360360
.functions.invoke('create-smart-session', {
361361
body: {
362-
action: 'cancel',
362+
action: 'manage',
363363
cancel_url: window.location.href
364364
}
365365
});
@@ -738,4 +738,4 @@ export default function Pricing() {
738738
<Footer />
739739
</div>
740740
);
741-
}
741+
}

0 commit comments

Comments
 (0)