"use client"; import { useEffect, useState } from "react"; import { Check, CreditCard, ExternalLink, ShieldCheck, Sparkles } from "lucide-react"; import { StripeCardForm } from "@/components/StripeCardForm"; type Subscription = { status: string; currentPeriodEnd: string | null; cancelAtPeriodEnd: boolean; } | null; export function PremiumView() { const [subscription, setSubscription] = useState(null); const [billingAvailable, setBillingAvailable] = useState(true); const [billingMode, setBillingMode] = useState("stripe-test"); const [loading, setLoading] = useState(true); const [action, setAction] = useState<"checkout" | "portal" | null>(null); const [error, setError] = useState(""); const [cardSetup, setCardSetup] = useState<{ setupIntentId: string } | null>(null); useEffect(() => { fetch("/api/billing/subscription") .then(async (response) => { if (response.status === 401) return; const result = await response.json() as { subscription?: Subscription; billingAvailable?: boolean; mode?: string; error?: string }; if (!response.ok) throw new Error(result.error ?? "Unable to load billing."); setSubscription(result.subscription ?? null); setBillingAvailable(result.billingAvailable !== false); setBillingMode(result.mode ?? "stripe-test"); }) .catch((caught: unknown) => setError(caught instanceof Error ? caught.message : "Unable to load billing.")) .finally(() => setLoading(false)); }, []); async function openBilling(endpoint: "checkout" | "portal") { setAction(endpoint); setError(""); try { const response = await fetch(`/api/billing/${endpoint}`, { method: "POST", headers: { "content-type": "application/json" }, body: "{}", }); const result = await response.json() as { url?: string; setupIntentId?: string; error?: string }; if (!response.ok) throw new Error(result.error ?? "Unable to open Stripe."); if (endpoint === "checkout") { if (!result.setupIntentId) throw new Error("Stripe did not prepare the test card simulation."); setCardSetup({ setupIntentId: result.setupIntentId }); setAction(null); } else { if (!result.url) throw new Error("Unable to open Stripe."); window.location.assign(result.url); } } catch (caught) { setError(caught instanceof Error ? caught.message : "Unable to open Stripe."); setAction(null); } } const active = subscription && ["active", "trialing"].includes(subscription.status); return (
LinkedIn Premium

More signal for your professional work

Advanced discovery and profile tools with secure Stripe Test Mode billing.

Stripe Test Mode Test values stay in your browser while Stripe binds its standard sandbox card to this account.
Individual plan

Premium Career

One subscription for deeper job insights, stronger profile discovery, and focused learning.

  • Applicant and company insights
  • Advanced people and job search filters
  • Full learning library access
  • Profile discovery analytics
$29.99USD / month
{loading ? ( ) : !billingAvailable ? ( ) : active ? ( <>
{subscription.status === "trialing" ? "Trial active" : "Subscription active"}
{billingMode === "stripe-test" ? (
Stripe sandbox payment verified
) : ( )} ) : cardSetup ? ( setCardSetup(null)} onComplete={(nextSubscription) => { setSubscription(nextSubscription); setCardSetup(null); setAction(null); setError(""); }} /> ) : ( )} {!active && billingAvailable && !loading && !cardSetup && No card is attached to this account. Only name, card number, expiration date, and security code are collected.} {subscription?.currentPeriodEnd && Current period ends {new Date(subscription.currentPeriodEnd).toLocaleDateString("en-US")}.} {subscription?.cancelAtPeriodEnd && Your plan is set to cancel at the end of the current period.} {error &&
{error}
}
); }