Skip to content

Accept Stripe webhooks across one API major release - #120

Merged
nedtwigg merged 2 commits into
mainfrom
stripe-webhook-major-release
Nov 28, 2026
Merged

nedtwigg merged 2 commits into
mainfrom
stripe-webhook-major-release

Conversation

@nedtwigg

@nedtwigg nedtwigg commented Nov 28, 2026 •

Copy link
Copy Markdown
Member

Why

verifyWebhook accepted only the installed SDK's exact STRIPE_API_VERSION. Every stripe minor release pins that month's API version, so each one became a webhook endpoint cut-over. That pushed applications into pinning stripe with ~, 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

  • verifyWebhook accepts an event whose api_version ends in .endive, exported as STRIPE_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.
  • Every event field the package reads (id, type, livemode, account, customer, and the Checkout session's id, mode, status, client_reference_id, metadata) is rendered at the first endive version.
  • SECURITY.md: the verifyWebhook rule now refers to STRIPE_API_RELEASE. A new FAIL IF rule 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 new unit/stripe-api-version.test.ts. checkout ownership, card policy, signatures, mode and API version are enforced now also refuses other major releases and accepts endive versions other than the SDK's.
  • BILLING.md, the package README and the CHANGELOG (Unreleased, not breaking) say that a stripe minor or patch is routine and only a new major release moves an endpoint.
  • Renovate requires dashboard approval for stripe majors. A major also fails the new unit test until STRIPE_API_RELEASE moves in the same PR.

Testing

pnpm check passes locally.

🤖 Generated with Claude Code

nedtwigg and others added 2 commits November 28, 2026 10:09
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>
@nedtwigg
nedtwigg merged commit 3df678f into main Nov 28, 2026
1 check passed
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.

1 participant