fix: convert polar_whs_ prefix to whsec_ for svix compatibility
This commit is contained in:
@@ -59,7 +59,9 @@ export function verifyPolarWebhook(
|
|||||||
): boolean {
|
): boolean {
|
||||||
if (!WEBHOOK_SECRET) return false;
|
if (!WEBHOOK_SECRET) return false;
|
||||||
try {
|
try {
|
||||||
const wh = new Webhook(WEBHOOK_SECRET);
|
// Svix whsec_ prefix bekler; polar_whs_ → whsec_ dönüşümü
|
||||||
|
const secret = WEBHOOK_SECRET.replace(/^polar_whs_/, "whsec_");
|
||||||
|
const wh = new Webhook(secret);
|
||||||
wh.verify(rawBody, headers);
|
wh.verify(rawBody, headers);
|
||||||
return true;
|
return true;
|
||||||
} catch {
|
} catch {
|
||||||
|
|||||||
Reference in New Issue
Block a user