Webhooks
Authentication
Verifying the origin of Webhook requests
$my_secret = 'CjXttYCtXJyDoyUxed8j'; // You can find this on the saleschannel page in your account.
$header_hmac = $_SERVER['HTTP_COTTONCAST_AUTHENTICATION'];
$body_hmac = hash_hmac('sha256', file_get_contents('php://input'),$my_secret);
if ($header_hmac !== $body_hmac)
throw new Exception("Unauthorized");
Response codes
Last updated
Was this helpful?