fix: map plan names to correct Stripe price IDs

- 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
This commit is contained in:
root
2026-02-19 13:49:28 +00:00
parent 9ed87efdeb
commit 5eb70b527a
+22 -1
View File
@@ -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<string, string> = {
// 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() {
))}
</ul>
<PaymentButton
planId={`demo-${selected}-${plan.name.toLowerCase().replace("starter", "starter").replace("site", "site").replace("growth", "growth")}`}
planId={getStripePlanId(plan.name, selected)}
planType="monthly"
label={lang === "es" ? "Elegir plan" : "Choose plan"}
variant={plan.popular ? "primary" : "secondary"}