Skip to content

[BREAKING] swap Stripe.webhooks from a factory function to a static property#2277

Merged
xavdid-stripe merged 1 commit intomasterfrom
DEVSDK-1702
Mar 25, 2025
Merged

[BREAKING] swap Stripe.webhooks from a factory function to a static property#2277
xavdid-stripe merged 1 commit intomasterfrom
DEVSDK-1702

Conversation

@xavdid-stripe
Copy link
Copy Markdown
Member

@xavdid-stripe xavdid-stripe commented Mar 21, 2025

Why?

In #1956, a user flagged that they wanted to be able to use webhook utilities before creating a Stripe instance. Since the webhook utilities were standalone (didn't depend on anything inside Stripe) we made them static. But because they were factory functions before, we didn't want to break that mid-cycle. Now that it's time for a major version, we can complete this change.

What?

  • set Stripe.webhooks to the result of createWebhooks() directly
  • set this.webhooks inside the Stripe constructor to the value at Stripe.webhooks

See Also

Changelog

  • Stripe.webhooks and Stripe().webhooks are no longer functions (just plain objects)
    • if you were already treating those properties as plain objects (per the types), then you can ignore this change
    • if you were calling Stripe.webhooks().someMethod(), you should use Stripe.webhooks.someMethod() instead
    • there shouldn't be user-facing functionality changing, just a slight breaking change in our internal organization

@xavdid-stripe xavdid-stripe requested a review from a team as a code owner March 21, 2025 21:43
@xavdid-stripe xavdid-stripe requested review from mbroshi-stripe and removed request for a team March 21, 2025 21:43
@xavdid-stripe xavdid-stripe enabled auto-merge (squash) March 21, 2025 21:43
@jar-stripe
Copy link
Copy Markdown
Contributor

This feels like a really big breaking change; I think we should discuss before merging.

@xavdid-stripe xavdid-stripe merged commit 812fcb7 into master Mar 25, 2025
9 checks passed
@xavdid-stripe xavdid-stripe deleted the DEVSDK-1702 branch March 25, 2025 18:56
@mbroshi-stripe
Copy link
Copy Markdown
Contributor

For posterity, we discussed this in our team design review meeting, and decided

  1. It would not affect many users
  2. Those that are affected have had ample lead time to update their code

ramya-stripe added a commit that referenced this pull request Apr 1, 2025
* Add Next.js App Router webhook example that leverages Route Handlers (#2259)

* Update generated code (#2256)

* Update generated code for v1463

* Update generated code for v1494

* Update generated code for v1495

* Update generated code for v1501

* Update generated code for v1505

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>

* Bump version to 17.7.0

* Update actions/cache as v2 is deprecated (#2269)

* remove test using soon-to-be-gone endpoint (#2270)

* [BREAKING] swap Stripe.webhooks from a factory function to a static property (#2277)

swap Stripe.webhooks from a factory function to a static property

* Remove tests for endpoints that were removed (#2281)

* Remove types that were marked as deprecated in Feb 2024 (#2286)

* Remove types that were marked as deprecated in Feb 2024

* remove the test for deprecated type

* add Amount interface (#2289)

* Update generated code for v1641

* Update generated code for v1641

* Update generated code for v1641

* Update generated code for v1641

* Support for APIs in the new API version 2025-03-31.basil (#2279)

Update generated code for v1641

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>

* Update generated code for v1642

* Update generated code for v1642

* Update generated code (#2291)

* Update generated code for v1642

* Update generated code for v1642

---------

Co-authored-by: Stripe OpenAPI <105521251+stripe-openapi[bot]@users.noreply.github.com>

* Update generated code for v1645

* Update generated code for v1646

---------

Co-authored-by: Jonathan Steele <83410553+jsteele-stripe@users.noreply.github.com>
Co-authored-by: stripe-openapi[bot] <105521251+stripe-openapi[bot]@users.noreply.github.com>
Co-authored-by: prathmesh-stripe <165320323+prathmesh-stripe@users.noreply.github.com>
Co-authored-by: Prathmesh Ranaut <prathmesh@stripe.com>
Co-authored-by: Ramya Rao <100975018+ramya-stripe@users.noreply.github.com>
Co-authored-by: David Brownman <109395161+xavdid-stripe@users.noreply.github.com>
Co-authored-by: helenye-stripe <111009531+helenye-stripe@users.noreply.github.com>
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.

3 participants