Skip to content

The open alternative to Salesforce, designed for AI.

Fix mismatching stripe subscription metadata plan/planKey (#11634)

Etiennedd1ac4deee16
diff --git a/packages/twenty-server/src/engine/core-modules/billing/utils/get-plan-key-from-subscription.util.ts b/packages/twenty-server/src/engine/core-modules/billing/utils/get-plan-key-from-subscription.util.ts
index cf26b8433f2..cbeffe0825b 100644
--- a/packages/twenty-server/src/engine/core-modules/billing/utils/get-plan-key-from-subscription.util.ts
+++ b/packages/twenty-server/src/engine/core-modules/billing/utils/get-plan-key-from-subscription.util.ts
@@ -4,9 +4,9 @@ import { BillingPlanKey } from 'src/engine/core-modules/billing/enums/billing-pl
export const getPlanKeyFromSubscription = (
subscription: BillingSubscription,
): BillingPlanKey => {
- const planKey = subscription.metadata?.planKey;
+ const plan = subscription.metadata?.plan; //To do : #867 Naming issue decide if we should rename stripe product metadata planKey to plan (+ productKey to product) OR at session checkout creating subscription with metadata planKey (and not plan)
- switch (planKey) {
+ switch (plan) {
case 'PRO':
return BillingPlanKey.PRO;
case 'ENTERPRISE':