Repository navigation
Accept Stripe webhooks across one API major release - #120
Merged
Merged
Conversation
verifyWebhook accepted only the installed SDK's exact STRIPE_API_VERSION, so every stripe minor release, which moves that version a month, was a webhook endpoint cut-over. Stripe's monthly versions within a major release add fields and break none, so it now accepts every version of the endive major release from 2026-10-28.endive (stripe 23.1, the bottom of the peer range) on. stripe minors and patches become routine updates. EARLIEST_STRIPE_API_VERSION and acceptsStripeApiVersion are exported so an application can test its endpoint's version. SECURITY.md gains the rule and its pinning test; BILLING.md, the package README, the changelog and the Renovate policy say that only a stripe major moves an endpoint. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The signature is verified before api_version is read, so the version string comes from Stripe and needs no format check, and Stripe says any version within a major release is safe. Replace EARLIEST_STRIPE_API_VERSION and acceptsStripeApiVersion with STRIPE_API_RELEASE = 'endive'. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
verifyWebhookaccepted only the installed SDK's exactSTRIPE_API_VERSION. Everystripeminor release pins that month's API version, so each one became a webhook endpoint cut-over. That pushed applications into pinningstripewith~, which leaves them without SDK bugfixes: stripe-node never patches an older minor.Stripe's monthly API versions within a major release (the name after the dot) add fields and break none. Its webhook docs say "You can safely upgrade your webhook endpoints to any API version in the same major release without making changes to your integration" (versioning, webhook versioning). Breaking changes come only twice a year, in a new major release.
What changes
verifyWebhookaccepts an event whoseapi_versionends in.endive, exported asSTRIPE_API_RELEASE. The signature is verified before the version is read, so the string comes from Stripe and needs no format check. Livemode and Connect checks are unchanged.id,type,livemode,account,customer, and the Checkout session'sid,mode,status,client_reference_id,metadata) is rendered at the first endive version.verifyWebhookrule now refers toSTRIPE_API_RELEASE. A newFAIL IFrule requires the installed SDK to be inside that release, and the package to read no field the release's first version lacks. It is pinned by the newunit/stripe-api-version.test.ts.checkout ownership, card policy, signatures, mode and API version are enforcednow also refuses other major releases and accepts endive versions other than the SDK's.stripeminor or patch is routine and only a new major release moves an endpoint.stripemajors. A major also fails the new unit test untilSTRIPE_API_RELEASEmoves in the same PR.Testing
pnpm checkpasses locally.🤖 Generated with Claude Code