Resolves billing tier (free/pro/lifetime) for a Stripe or Lemon Squeezy subscription, mapping variant/prices to app pricing model for getServerSession.
import { env } from "@/env";
import { PremiumTier } from "@prisma/client";
type Feature = { text: string; tooltip?: string };
export type Tier = {
name: string;
tiers: { monthly: PremiumTier; annually: PremiumTier };
price: { monthly: number; annually: number };
priceAdditional: { monthly: number; annually: number };
discount: { monthly: number; annually: number };
quantity?: number;
description: string;
features: Feature[];
cta: string;
ctaLink?: string;
mostPopular?: boolean;
};
const pricing: Record<PremiumTier, number> = {
[PremiumTier.BASIC_MONTHLY]: 16,
[PremiumTier.BASIC_ANNUALLY]: 8,
[PremiumTier.PRO_MONTHLY]: 16,
[PremiumTier.PRO_ANNUALLY]: 10,
[PremiumTier.BUSINESS_MONTHLY]: 20,
[PremiumTier.BUSINESS_ANNUALLY]: 16,
[PremiumTier.BUSINESS_PLUS
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key