restrict Stripe webhook plan ids

This commit is contained in:
2026-09-06 17:56:07 +03:00
parent 661612d97f
commit 8f62f2f0cf
+2 -1
View File
@@ -1321,7 +1321,8 @@ const server = http.createServer(async (req, res) => {
const rawEmail = o.client_reference_id || o.customer_email || o.metadata?.email || ''; const rawEmail = o.client_reference_id || o.customer_email || o.metadata?.email || '';
const email = typeof rawEmail === 'string' ? rawEmail.trim().toLowerCase() : ''; const email = typeof rawEmail === 'string' ? rawEmail.trim().toLowerCase() : '';
const rawPlanId = o.metadata?.planId; const rawPlanId = o.metadata?.planId;
const planId = typeof rawPlanId === 'string' && rawPlanId.trim() ? rawPlanId.trim() : 'pro'; const candidatePlan = typeof rawPlanId === 'string' ? rawPlanId.trim() : '';
const planId = ['pro', 'kurumsal'].includes(candidatePlan) ? candidatePlan : 'pro';
if (email) { if (email) {
store.setPlan(email, { store.setPlan(email, {
plan: planId, kaynak: 'stripe', plan: planId, kaynak: 'stripe',