validate Stripe checkout responses

This commit is contained in:
2026-09-06 17:47:26 +03:00
parent 66e4f53639
commit cd06cafddf
+2
View File
@@ -188,6 +188,8 @@ export async function createCheckoutSession({ planId, email, periyot = 'yillik'
});
const data = await res.json().catch(() => ({}));
if (!res.ok) throw new Error(data?.error?.message || `Stripe hatası: HTTP ${res.status}`);
if (typeof data.url !== 'string' || !/^https:\/\//.test(data.url) || typeof data.id !== 'string' || !data.id.trim())
throw new Error('Stripe checkout yanıtı geçersiz.');
return { url: data.url, id: data.id };
}