validate Stripe checkout responses
This commit is contained in:
@@ -188,6 +188,8 @@ export async function createCheckoutSession({ planId, email, periyot = 'yillik'
|
|||||||
});
|
});
|
||||||
const data = await res.json().catch(() => ({}));
|
const data = await res.json().catch(() => ({}));
|
||||||
if (!res.ok) throw new Error(data?.error?.message || `Stripe hatası: HTTP ${res.status}`);
|
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 };
|
return { url: data.url, id: data.id };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user