Verifying Webhook Signatures: Stripe, GitHub, Slack

A webhook endpoint is a public URL. Anyone who learns it can POST to it, which means "we received a request" proves nothing about who sent it. Every provider solves this the same way: they HMAC the request body with a secret only the two of you know, and put the digest in a header. Your server recomputes the digest and rejects anything that does not match.
The concept is simple. The implementations disagree on almost every detail, which is why a check that works against Stripe fails against Shopify for reasons that have nothing to do with your code being wrong.
What the tool does
The Webhook Signature Verifier recomputes signatures for seven providers in the browser, shows the exact string that gets signed, and reports the replay window separately from signature validity. It also exports the equivalent server-side check for Node.js, Python, PHP and Go.
It is most useful for the case that actually costs time: a delivery you know is genuine that keeps failing verification.
The raw body problem
This is the single most common cause, and it is not a cryptography problem at all.
Most frameworks helpfully parse application/json before your handler sees it. You then hash the parsed object re-serialised back to a string — and that string is not the one the provider signed. {"a":1, "b":2} and {"a":1,"b":2} are the same object and different bytes. Key order, whitespace, Unicode escaping and float formatting can all shift.
You need the untouched bytes:
- Express —
app.post('/hook', express.raw({ type: '*/*' }), handler) - Flask —
request.get_data(as_text=True), notrequest.json - PHP —
file_get_contents('php://input') - Go —
io.ReadAll(r.Body)before any decoding
If verification fails, check this before anything else.
Everyone signs something different
The second trap is assuming the signed string is the body. Only sometimes:
| Provider | Header | Signed string | Encoding |
|---|---|---|---|
| Stripe | Stripe-Signature | timestamp.body | hex |
| GitHub | X-Hub-Signature-256 | body | hex |
| Slack | X-Slack-Signature | v0:timestamp:body | hex |
| Shopify | X-Shopify-Hmac-Sha256 | body | base64 |
| Paddle | Paddle-Signature | timestamp:body | hex |
| Lemon Squeezy | X-Signature | body | hex |
Three things to notice. Stripe joins the timestamp with a dot, Paddle with a colon, and Slack prefixes a scheme version — get the separator wrong and the digest is wrong. Stripe separates header elements with commas, Paddle with semicolons. And Shopify is the odd one out on encoding: its digest is base64, so comparing it against a hex string fails unconditionally, even when the HMAC underneath is perfect.
The timestamp is not decoration
Stripe, Slack and Paddle include a timestamp inside the signed string. That is what makes replay protection possible: an attacker who captures a valid delivery cannot change the timestamp without invalidating the signature, so rejecting anything older than a few minutes closes the replay window.
This is worth stating precisely, because it is easy to conflate two different questions:
- Is the signature valid? — did this payload come from the provider, ever.
- Is it fresh? — did it arrive within the tolerance window.
An archived payload from last month has a perfectly valid signature and is far outside any sane window. The tool reports these separately for that reason. A verifier that returns true on signature alone will happily accept a replayed payment notification.
GitHub, Shopify and Lemon Squeezy do not include a timestamp, so replay protection there has to come from event IDs and idempotency on your side.
Telegram is a different animal
The Telegram Bot API is included because it answers the same question — is this webhook authentic — but it does not use HMAC at all. You pass a secret_token to setWebhook, and Telegram echoes it back verbatim in X-Telegram-Bot-Api-Secret-Token on every delivery. Verification is a constant-time string comparison.
The security property is genuinely weaker and worth understanding: the token authenticates the sender, not the body. With an HMAC scheme, altering a single byte of the payload invalidates the signature. With Telegram's scheme nothing is signed, so the token proves the request came from something holding your token, and TLS is what actually keeps that token from being observed in transit.
Compare in constant time
Once you have both digests, do not use ==. A naive string comparison can return as soon as two bytes differ, and that timing difference is, in principle, enough to reconstruct a valid signature byte by byte. Every language ships the safe version: crypto.timingSafeEqual, hmac.compare_digest, hash_equals, subtle.ConstantTimeCompare. The exported snippets use them.
Workflow
- Pick the provider and read its scheme card — header, signed string, encoding.
- Paste the raw body, the request headers as JSON, and the signing secret.
- If it fails, compare the computed digest against the received one and check the signed string is what you expected.
- Copy the verification function for your stack.
Related Tools
Frequently asked questions
Why does my webhook signature never match even with the correct secret?
Almost always because the body was re-serialised. If a framework parses JSON before your handler runs and you hash the re-encoded object, whitespace and key order change and so does the digest. You must hash the exact raw bytes received.
Do all providers sign the same thing?
No. GitHub, Shopify and Lemon Squeezy sign the raw body alone. Stripe signs timestamp.body, Slack signs v0:timestamp:body, and Paddle signs timestamp:body. Signing the wrong string fails even with the right secret.
Why is Shopify's signature never matching my hex digest?
Shopify encodes the HMAC as base64, not hex. Comparing a base64 digest against a hex one fails every time regardless of whether the underlying HMAC is correct.
What is the timestamp element in a Stripe or Slack signature for?
It defeats replay attacks. Because the timestamp is part of the signed string, an attacker cannot change it without breaking the signature, so you can reject deliveries older than a few minutes.
Does Telegram sign its webhook payloads?
No. Telegram echoes the secret_token you set via setWebhook in a header, and verification is a constant-time string comparison. It authenticates the sender but does not protect the body, unlike the HMAC schemes.
Why compare digests in constant time?
A naive equality check can return early on the first differing byte. In principle that leaks timing information an attacker could use to reconstruct a valid signature, so use timingSafeEqual, hmac.compare_digest or hash_equals.
Are secrets sent anywhere by this tool?
No. Verification runs through the Web Crypto API in your browser. Payloads and signing secrets are never transmitted or stored.



