Skip to content

tolerance, receivedAt, timestamp are now optional in Webhook.ts#2670

Draft
prathmesh-stripe wants to merge 1 commit intomasterfrom
prathmesh/fix-webhook-signature
Draft

tolerance, receivedAt, timestamp are now optional in Webhook.ts#2670
prathmesh-stripe wants to merge 1 commit intomasterfrom
prathmesh/fix-webhook-signature

Conversation

@prathmesh-stripe
Copy link
Copy Markdown
Contributor

@prathmesh-stripe prathmesh-stripe commented Apr 8, 2026

Why?

In v22, several webhook method parameters that were previously optional in manually maintained became required due to a type consolidation.
generateTestHeaderString only truly requires payload and secret (all other fields have defaults). verifyHeader/constructEvent work without explicit tolerance and cryptoProvider arguments. Users upgrading to v22 now get TypeScript errors when calling these methods with the same arguments that worked in v21.

What?

  • Made timestamp, scheme, signature, and cryptoProvider optional in WebhookTestHeaderOptions
  • Made tolerance and cryptoProvider optional in verifyHeader/verifyHeaderAsync signatures
  • Made scheme optional in parseHeader
  • Updated prepareOptions return type to reflect that defaulted fields are resolved to non-optional
  • Added tests covering all optional parameter default behaviors

See Also

Changelog

@prathmesh-stripe prathmesh-stripe force-pushed the prathmesh/fix-webhook-signature branch from df30437 to 4b1ef97 Compare April 8, 2026 03:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

v22 - change to generateTestHeaderString

1 participant