From 5eb70b527aa9c28c28d6d245e2e641a11bedc9b0 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 19 Feb 2026 13:49:28 +0000 Subject: [PATCH] fix: map plan names to correct Stripe price IDs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add PLAN_NAME_TO_STRIPE_ID mapping helper - Maps: Chat IA → essential, Chat + Voz → profesional, Empresa IA → premium - Fixes bug where wrong plan IDs were sent to Stripe (e.g. 'chat ia' instead of 'essential') - Test calls verified for all 3 tiers across verticals --- app/demos/page.tsx | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/app/demos/page.tsx b/app/demos/page.tsx index f7620d6..087ed01 100644 --- a/app/demos/page.tsx +++ b/app/demos/page.tsx @@ -11,6 +11,27 @@ type Language = "es" | "en"; type Vertical = "real-estate" | "restaurant" | "clinic" | "home-services" | "car-rental"; type Location = "generic" | "benalmadena"; +// Map internal plan names to Stripe price IDs +// Essential = Chat IA / AI Chat (€299) +// Profesional = Chat + Voz / Chat + Voice (€599) +// Premium = Empresa IA / AI Company (€1,499) +const PLAN_NAME_TO_STRIPE_ID: Record = { + // Spanish + "chat ia": "essential", + "chat + voz": "profesional", + "empresa ia": "premium", + // English + "ai chat": "essential", + "chat + voice": "profesional", + "ai company": "premium", +}; + +function getStripePlanId(planName: string, vertical: string): string { + const normalizedName = planName.toLowerCase().trim(); + const tier = PLAN_NAME_TO_STRIPE_ID[normalizedName] || "essential"; + return `demo-${vertical}-${tier}`; +} + const contentByLang = { es: { nav: { features: "Características", pricing: "Precios", contact: "Contacto", cta: "Pedir demo" }, @@ -473,7 +494,7 @@ function DemosContent() { ))}