Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion static/gsApp/views/decideCheckout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {useLocation} from 'sentry/utils/useLocation';
import {useNavigate} from 'sentry/utils/useNavigate';
import useOrganization from 'sentry/utils/useOrganization';

import useSubscription from 'getsentry/hooks/useSubscription';
import {PlanTier} from 'getsentry/types';
import {hasPartnerMigrationFeature} from 'getsentry/utils/billing';
import AMCheckout from 'getsentry/views/amCheckout';
Expand All @@ -14,12 +15,14 @@ function DecideCheckout() {
const navigate = useNavigate();
const location = useLocation();
const organization = useOrganization();
const subscription = useSubscription();
const [tier, setTier] = useState<string | null>(null);
const isNewCheckout = hasCheckoutV3(organization);

const checkoutProps = {
organization,
onToggleLegacy: setTier,
isNewCheckout: hasCheckoutV3(organization),
isNewCheckout,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: AM3 Subscription Renders Incorrect Checkout

Customers with an AM3 subscription are incorrectly shown the AM2 checkout when isNewCheckout is active, and their organization lacks the am3-billing feature or isn't a migrating partner. While the useEffect correctly sets the tier to PlanTier.AM3, the rendering logic falls through to the AM2 condition, contradicting the goal of keeping customers on their current tier.

Fix in Cursor Fix in Web

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

customers with AM3 subscription inherently have the am3-billing flag

location,
navigate,
};
Expand All @@ -34,6 +37,12 @@ function DecideCheckout() {
);
}

if (isNewCheckout && tier === null) {
// if we're showing new checkout, ensure we show the checkout for
// the current plan tier (we will not toggle between tiers for legacy checkout)
setTier(subscription?.planTier ?? null);
}

if (tier !== PlanTier.AM1) {
return (
<ErrorBoundary errorTag={{checkout: PlanTier.AM2}}>
Expand Down
Loading