Skip to main content
Verifying webhook signatures is crucial for security. It ensures that the webhook actually came from storekit and hasn’t been tampered with.

Why Verify?

Since your webhook endpoint is publicly accessible, anyone could send requests to it pretending to be storekit. Signature verification prevents:
  • Spoofed requests: Attackers sending fake webhooks
  • Replay attacks: Old webhooks being resent maliciously
  • Data tampering: Modification of webhook payloads in transit
We recommend using the official Svix libraries for verification, which handle all the complexity for you:
Always use the raw request body for verification. If you parse the JSON first and then stringify it, the signature will not match due to potential formatting differences.

Manual Verification

If you prefer to verify signatures manually without using the Svix library, follow the steps below.

Signature Headers

Each webhook includes these headers for verification:

Verification Steps

1. Extract the Headers

2. Verify Timestamp (Prevent Replay Attacks)

Reject webhooks with timestamps older than 5 minutes:

3. Create the Signed Content

Concatenate the webhook ID, timestamp, and body:

4. Calculate Expected Signature

Use HMAC-SHA256 with your webhook secret:

5. Compare Signatures