Stripe webhook t=/v1= signatures and the replay tolerance
Stripe sends payments, subscriptions and refunds as webhooks. The Stripe-Signature header carries a timestamp and one or more signatures.
Stripe-Signature: t=1764500000,v1=3f2a9c...
The signed message
Stripe concatenates the timestamp, a period and the raw body, then computes HMAC-SHA256. The result is placed in v1 as hexadecimal. Because the timestamp is signed, a valid signature still needs a freshness check.
signed_payload = t + "." + raw_body
Reading the header
t=is a Unix timestamp in seconds.v1=is the HMAC-SHA256 signature. Several may arrive, separated by commas.v0=was an older scheme and is not used by new integrations.- Ignore unknown prefixes, but reject the request when no
v1is present.
During rotation, deliveries signed with the old secret and the new secret arrive together. That produces multiple v1 values, and any one match is enough. Stripe's official libraries implement this in constructEvent.
Replay tolerance
The official libraries default to a 300-second tolerance. If the difference between now and t is larger, the request is rejected even when the signature matches. Check NTP synchronisation, or valid requests will fail when the server clock drifts.
| Difference | Verdict | Action |
|---|---|---|
| 0–300 s | Within tolerance | Process when the signature matches |
| Over 300 s | Possible replay | Reject with 400 and log |
| Future timestamp | Check clock skew | Reject when outside tolerance |
Common mistakes
- Computing
{t}.{body}from a re-serialised body - Leaving
t=out of the signed message - Checking only the first of several
v1values, which fails during rotation - Mixing test-mode and live-mode secrets
- Ignoring the tolerance so old events are processed again
Stripe can deliver the same event more than once. Even after signature verification, deduplicate by event.id.
Questions
What do I do with several v1 values?
Compare each in constant time and pass when any matches. Old and new secrets coexist during rotation.
Where does 300 seconds come from?
It is the default tolerance in Stripe's official libraries. With an accurate server clock it is a safe default.
Are test-mode webhooks signed?
Yes, with that mode's secret. When forwarding with the Stripe CLI, use the secret the CLI prints.
Paste a Stripe header and check the tolerance too.
Open the toolThis guide follows the HMAC definition in RFC 2104 and the public webhook documentation of GitHub, Slack and Stripe. Every example value is synthetic.