feat(frontend): route checkout through V2 Identity plan-purchase; drop dead Stripe webhook
/api/checkout now resolves the requested plan (pro|business × monthly|annual) to a plan GUID via gateway /v1/plans (codes follow pro_monthly / business_annual) and POSTs /v1/users/me/plan/purchase. The payments service owns the gateway (ZarinPal/Stripe) and returns redirect_url, which we hand back unchanged. Removes the orphaned Stripe→Supabase webhook + lib/stripe.ts client: profile plan reads come from Identity now, so the Supabase profiles upsert loop is dead. V2 payments has its own gateway callback (skip-auth, payment-callback route). Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -1,20 +0,0 @@
|
||||
import Stripe from "stripe";
|
||||
|
||||
let stripeClient: Stripe | null = null;
|
||||
|
||||
export function getStripe(): Stripe {
|
||||
if (!stripeClient) {
|
||||
const secretKey = process.env.STRIPE_SECRET_KEY;
|
||||
|
||||
if (!secretKey) {
|
||||
throw new Error("Missing STRIPE_SECRET_KEY environment variable.");
|
||||
}
|
||||
|
||||
stripeClient = new Stripe(secretKey, {
|
||||
apiVersion: "2026-04-22.dahlia",
|
||||
typescript: true,
|
||||
});
|
||||
}
|
||||
|
||||
return stripeClient;
|
||||
}
|
||||
Reference in New Issue
Block a user