diff --git a/example/convex/example.ts b/example/convex/example.ts index ec7432a..a10e6d5 100644 --- a/example/convex/example.ts +++ b/example/convex/example.ts @@ -41,9 +41,10 @@ const currentUser = async (ctx: QueryCtx) => { const subscription = await polar.getCurrentSubscription(ctx, { userId: user._id, }); - const isPremiumPlus = subscription?.product?.id === products.premiumPlus; + const isPremiumPlus = + subscription?.product?.id === polar.products.premiumPlus; const isPremium = - isPremiumPlus || subscription?.product?.id === products.premium; + isPremiumPlus || subscription?.product?.id === polar.products.premium; return { ...user, isPremium, diff --git a/example/src/BillingSettings.tsx b/example/src/BillingSettings.tsx index 9e94184..813b922 100644 --- a/example/src/BillingSettings.tsx +++ b/example/src/BillingSettings.tsx @@ -19,6 +19,13 @@ export function BillingSettings({ : isPremium ? "Premium" : "Free"; + + const currentPrice = isPremiumPlus + ? "$20/month or $200/year" + : isPremium + ? "$10/month or $100/year" + : "Free"; + const features = isPremiumPlus ? ["Unlimited todos", "No ads", "Priority support", "Advanced analytics"] : isPremium @@ -61,9 +68,21 @@ export function BillingSettings({

Current Plan:

- - {currentPlan} - +
+ + {currentPlan} + + {currentPrice !== "Free" && ( +
+ + {isPremiumPlus ? "$20/month" : "$10/month"} + + + or {isPremiumPlus ? "$200/year" : "$100/year"} + +
+ )} +