diff --git a/server/billing.mjs b/server/billing.mjs index 645fe91..2e4d07a 100644 --- a/server/billing.mjs +++ b/server/billing.mjs @@ -228,8 +228,11 @@ export async function cancelSubscription({ subId, neden, aciklama }) { }); const data = await res.json().catch(() => ({})); if (!res.ok) throw new Error(data?.error?.message || `Stripe hatası: HTTP ${res.status}`); + if (typeof data.id !== 'string' || !data.id.trim() || typeof data.status !== 'string' || !data.status.trim()) + throw new Error('Stripe abonelik iptal yanıtı geçersiz.'); return { id: data.id, + status: data.status, donemSonunda: Boolean(data.cancel_at_period_end), bitis: data.cancel_at ? new Date(data.cancel_at * 1000).toISOString() : null, };