Conversation
stripeMethod and standardize how function args are handled
stripeMethod and standardize how function args are handledstripeMethod and standardize how function args are handled (and remove callback support)
stripeMethod and standardize how function args are handled (and remove callback support)stripeMethod and standardize how function args are handled (including removing callback support)
xavdid
commented
Apr 2, 2026
jar-stripe
approved these changes
Apr 2, 2026
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?
The Node SDK's API methods have always been a little unusual among our SDKs. Rather than generate API calls directly, it generated "method specs" which included a path, expected arguments, and response type (among others). Then, because the runtime function couldn't know anything about the incoming arguments, it shipped a bunch of logic to extract path arguments, params objects, options objects, and API keys. This has worked well enough, but was overly generous about the inputs it would handle. This has lead to both bugs and surprising behavior.
So the goal of this PR is simple: fully type our runtime code to match the generated type signatures.
As a result, we're removing a lot of ways it's been possible to call these methods. All of these used to be valid, but would show type errors during editing:
Now, callers have to conform to a much more consistent (and well typed) signature:
This means we're dropping support for:
RequestOptionsas the first argument if the method takesParamsparamsoroptionsobjectsThis gets us a much more consistent HTTP request experience internally and reduces the opportunity for surprising behavior.
What?
this._makeRequestwith the proper inputs instead of going throughStripeMethodStripeMethodand a bunch of supporting code (like url param replacers).methodand.extendfunctions - these were never meant to be public facing and weren't used outside our testsStripeResource._makeRequestto take method, path, params, etc instead of an untyped array. Update body accordinglyRequestOptionstype since only one was user-facingSee Also
Changelog
async / awaitinsteadRequestOptionsunder theapiKeypropertyparamsandoptionsobjects are no longer mixed. If present on a method,RequestParamsmust always come first andRequestOptionsmust always come second. To supply options without params, passundefinedas the first argument explicitlyStripeResource:createFullPath,createResourcePathWithSymbols,extend,methodand_joinUrlParts. These were mostly intended for internal use and we no longer need themAs a result, the following call patterns are no longer supported:
If those look familiar, head over to the migration guide to update your code.