Skip to content

Commit e83b6e8

Browse files
fix(checkout v3): Keep customers on current tiers (#99423)
For new checkout, we will keep customers on their current tier, not surfacing the tier toggle for legacy plans.
1 parent 11cba78 commit e83b6e8

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

static/gsApp/views/decideCheckout.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
import {useState} from 'react';
1+
import {useEffect, useState} from 'react';
22

33
import ErrorBoundary from 'sentry/components/errorBoundary';
44
import {useLocation} from 'sentry/utils/useLocation';
55
import {useNavigate} from 'sentry/utils/useNavigate';
66
import useOrganization from 'sentry/utils/useOrganization';
77

8+
import useSubscription from 'getsentry/hooks/useSubscription';
89
import {PlanTier} from 'getsentry/types';
910
import {hasPartnerMigrationFeature} from 'getsentry/utils/billing';
1011
import AMCheckout from 'getsentry/views/amCheckout';
@@ -14,12 +15,22 @@ function DecideCheckout() {
1415
const navigate = useNavigate();
1516
const location = useLocation();
1617
const organization = useOrganization();
18+
const subscription = useSubscription();
1719
const [tier, setTier] = useState<string | null>(null);
20+
const isNewCheckout = hasCheckoutV3(organization);
21+
22+
useEffect(() => {
23+
// if we're showing new checkout, ensure we show the checkout for
24+
// the current plan tier (we will not toggle between tiers for legacy checkout)
25+
if (isNewCheckout) {
26+
setTier(subscription?.planTier ?? null);
27+
}
28+
}, [subscription?.planTier, isNewCheckout]);
1829

1930
const checkoutProps = {
2031
organization,
2132
onToggleLegacy: setTier,
22-
isNewCheckout: hasCheckoutV3(organization),
33+
isNewCheckout,
2334
location,
2435
navigate,
2536
};

0 commit comments

Comments
 (0)