// Created on savesnippets.com ยท https://savesnippets.com/AL5776SqX3lygu $tolerance) return false; $signed = $parts['t'] . '.' . $rawBody; $expected = hash_hmac('sha256', $signed, $secret); return hash_equals($expected, $parts['v1']); } $raw = file_get_contents('php://input'); $sig = $_SERVER['HTTP_X_SIGNATURE'] ?? ''; if (!verifyWebhookSig($raw, $sig, getenv('WEBHOOK_SECRET'))) { http_response_code(400); exit('Bad signature'); }