-
Notifications
You must be signed in to change notification settings - Fork 5.3k
[FEATURE] Upgrade Pipedream Stripe App to Latest Stable API Version #16463
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Skipped Deployments
|
## Walkthrough
This update modifies the Stripe integration by upgrading the Stripe SDK dependency from version 8.x to 18.x, updates the default Stripe API version from "2020-03-02" to "2025-03-31.basil", and adjusts the Stripe client instantiation to use the new SDK import style. Additionally, the version numbers for all Stripe actions and sources are incremented (mostly from "0.1.1" to "0.1.2" or "0.1.3"/"0.1.4" for sources). The "Create Usage Record" action was removed, and a new "Create Billing Meter" action and a utility module with JSON parsing and date conversion functions were added. Several actions were enhanced to parse advanced options as JSON before use, and many list actions were extended with new filtering and pagination props.
## Changes
| File(s) | Change Summary |
|----------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------|
| components/stripe/stripe.app.mjs | Updated Stripe SDK import to named import, changed client instantiation, set API version to "2025-03-31.basil". Added new filtering and pagination props; removed `usage_record_action` prop. |
| components/stripe/package.json | Upgraded Stripe SDK dependency from ^8.168.0 to ^18.0.0. |
| components/stripe/common/utils.mjs | Added utility module with `parseJson` (recursive JSON parsing) and `fromDateToInteger` (date string to timestamp).|
| components/stripe/actions/create-billing-meter/create-billing-meter.mjs | Added new action to create billing meters with configurable aggregation, event name, and optional keys. |
| components/stripe/actions/create-customer/*, capture-payment-intent, confirm-payment-intent, create-invoice, create-invoice-item, update-customer, update-invoice-item, update-invoice | Changed handling of `advanced` prop to parse JSON before spreading into Stripe SDK calls; imported utils module; bumped versions. |
| components/stripe/actions/create-subscription/create-subscription.mjs | Added optional `advanced` prop parsed as JSON and spread into subscription creation parameters; bumped version. |
| components/stripe/actions/list-balance-history/list-balance-history.mjs | Added filtering and pagination props; refactored to explicit param construction; bumped version to 0.1.6. |
| components/stripe/actions/list-customers/list-customers.mjs | Added filtering and pagination props; refactored param handling; bumped version. |
| components/stripe/actions/list-invoices/list-invoices.mjs | Added filtering and pagination props; refactored param handling; bumped version. |
| components/stripe/actions/list-payment-intents/list-payment-intents.mjs | Added JSON parsing of `advanced` prop before spreading; bumped version. |
| components/stripe/actions/list-payouts/list-payouts.mjs | Added filtering and pagination props; refactored param handling; bumped version. |
| components/stripe/actions/create-payment-intent, create-payout, create-price, create-product, create-refund, cancel-or-reverse-payout, cancel-payment-intent, delete-customer, delete-invoice-item, delete-or-void-invoice, finalize-invoice, list-refunds, retrieve-balance, retrieve-checkout-session, retrieve-checkout-session-line-items, retrieve-customer, retrieve-invoice, retrieve-invoice-item, retrieve-payment-intent, retrieve-payout, retrieve-price, retrieve-product, retrieve-refund, send-invoice, update-payment-intent, update-payout, update-refund, void-invoice, write-off-invoice, abandoned-cart source, canceled-subscription source, custom-webhook-events source, new-customer source, new-dispute source, new-failed-invoice-payment source, new-failed-payment source, new-invoice source, new-payment source, new-subscription source, subscription-updated source | Version bumps only (mostly from 0.1.1 to 0.1.2, sources from 0.1.2 to 0.1.3/0.1.4); minor event addition in subscription-updated source. |
| components/stripe/actions/create-usage-record/create-usage-record.mjs | Removed entire action module. |
## Sequence Diagram(s)
```mermaid
sequenceDiagram
participant Action as Stripe Action
participant Utils as Utils Module
participant SDK as Stripe SDK
participant API as Stripe API
Action->>Utils: parseJson(advanced options)
Utils-->>Action: parsed options object
Action->>SDK: Call Stripe API with merged params (including parsed advanced options)
SDK->>API: API request with updated params
API-->>SDK: API response
SDK-->>Action: Return response sequenceDiagram
participant StripeApp as Stripe App
participant StripeSDK as Stripe SDK
StripeApp->>StripeSDK: Import Stripe (v18.x)
StripeApp->>StripeSDK: Instantiate Stripe client (API version "2025-03-31.basil")
StripeApp->>StripeSDK: Make API requests using new client
StripeSDK-->>StripeApp: Return responses
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
|
b90e329
to
c0ffd52
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moving it to QA, but I think the package version number needs to be fixed
c0ffd52
to
b463b99
Compare
b463b99
to
8c41a71
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (2)
components/stripe/common/utils.mjs (1)
24-31
: Consider adding explicit return value for invalid datesThe function currently returns
undefined
implicitly when validation fails. For better clarity, consider adding an explicit return statement.const fromDateToInteger = (date) => { if (typeof date === "string") { const parsedDate = new Date(date); if (!isNaN(parsedDate.getTime())) { return Math.floor(parsedDate.getTime() / 1000); } } + return undefined; };
components/stripe/actions/create-billing-meter/create-billing-meter.mjs (1)
69-101
: Robust implementation with conditional parametersThe implementation correctly:
- Destructures props from this
- Builds request parameters with conditional inclusion of optional settings
- Returns a clear summary message with the created meter ID
Consider using the utils.parseJson for any advanced options if they're added in the future, to maintain consistency with other Stripe actions.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (59)
components/stripe/actions/cancel-or-reverse-payout/cancel-or-reverse-payout.mjs
(1 hunks)components/stripe/actions/cancel-payment-intent/cancel-payment-intent.mjs
(1 hunks)components/stripe/actions/capture-payment-intent/capture-payment-intent.mjs
(2 hunks)components/stripe/actions/confirm-payment-intent/confirm-payment-intent.mjs
(2 hunks)components/stripe/actions/create-billing-meter/create-billing-meter.mjs
(1 hunks)components/stripe/actions/create-customer/create-customer.mjs
(2 hunks)components/stripe/actions/create-invoice-item/create-invoice-item.mjs
(3 hunks)components/stripe/actions/create-invoice/create-invoice.mjs
(2 hunks)components/stripe/actions/create-payment-intent/create-payment-intent.mjs
(1 hunks)components/stripe/actions/create-payout/create-payout.mjs
(1 hunks)components/stripe/actions/create-price/create-price.mjs
(1 hunks)components/stripe/actions/create-product/create-product.mjs
(1 hunks)components/stripe/actions/create-refund/create-refund.mjs
(1 hunks)components/stripe/actions/create-subscription/create-subscription.mjs
(3 hunks)components/stripe/actions/create-usage-record/create-usage-record.mjs
(0 hunks)components/stripe/actions/delete-customer/delete-customer.mjs
(1 hunks)components/stripe/actions/delete-invoice-item/delete-invoice-item.mjs
(1 hunks)components/stripe/actions/delete-or-void-invoice/delete-or-void-invoice.mjs
(1 hunks)components/stripe/actions/finalize-invoice/finalize-invoice.mjs
(1 hunks)components/stripe/actions/list-balance-history/list-balance-history.mjs
(3 hunks)components/stripe/actions/list-customers/list-customers.mjs
(2 hunks)components/stripe/actions/list-invoices/list-invoices.mjs
(2 hunks)components/stripe/actions/list-payment-intents/list-payment-intents.mjs
(2 hunks)components/stripe/actions/list-payouts/list-payouts.mjs
(2 hunks)components/stripe/actions/list-refunds/list-refunds.mjs
(1 hunks)components/stripe/actions/retrieve-balance/retrieve-balance.mjs
(1 hunks)components/stripe/actions/retrieve-checkout-session-line-items/retrieve-checkout-session-line-items.mjs
(1 hunks)components/stripe/actions/retrieve-checkout-session/retrieve-checkout-session.mjs
(1 hunks)components/stripe/actions/retrieve-customer/retrieve-customer.mjs
(1 hunks)components/stripe/actions/retrieve-invoice-item/retrieve-invoice-item.mjs
(1 hunks)components/stripe/actions/retrieve-invoice/retrieve-invoice.mjs
(1 hunks)components/stripe/actions/retrieve-payment-intent/retrieve-payment-intent.mjs
(1 hunks)components/stripe/actions/retrieve-payout/retrieve-payout.mjs
(1 hunks)components/stripe/actions/retrieve-price/retrieve-price.mjs
(1 hunks)components/stripe/actions/retrieve-product/retrieve-product.mjs
(1 hunks)components/stripe/actions/retrieve-refund/retrieve-refund.mjs
(1 hunks)components/stripe/actions/send-invoice/send-invoice.mjs
(1 hunks)components/stripe/actions/update-customer/update-customer.mjs
(2 hunks)components/stripe/actions/update-invoice-item/update-invoice-item.mjs
(2 hunks)components/stripe/actions/update-invoice/update-invoice.mjs
(2 hunks)components/stripe/actions/update-payment-intent/update-payment-intent.mjs
(1 hunks)components/stripe/actions/update-payout/update-payout.mjs
(1 hunks)components/stripe/actions/update-refund/update-refund.mjs
(1 hunks)components/stripe/actions/void-invoice/void-invoice.mjs
(1 hunks)components/stripe/actions/write-off-invoice/write-off-invoice.mjs
(1 hunks)components/stripe/common/utils.mjs
(1 hunks)components/stripe/package.json
(1 hunks)components/stripe/sources/abandoned-cart/abandoned-cart.mjs
(1 hunks)components/stripe/sources/canceled-subscription/canceled-subscription.mjs
(1 hunks)components/stripe/sources/custom-webhook-events/custom-webhook-events.mjs
(1 hunks)components/stripe/sources/new-customer/new-customer.mjs
(1 hunks)components/stripe/sources/new-dispute/new-dispute.mjs
(1 hunks)components/stripe/sources/new-failed-invoice-payment/new-failed-invoice-payment.mjs
(1 hunks)components/stripe/sources/new-failed-payment/new-failed-payment.mjs
(1 hunks)components/stripe/sources/new-invoice/new-invoice.mjs
(1 hunks)components/stripe/sources/new-payment/new-payment.mjs
(1 hunks)components/stripe/sources/new-subscription/new-subscription.mjs
(1 hunks)components/stripe/sources/subscription-updated/subscription-updated.mjs
(1 hunks)components/stripe/stripe.app.mjs
(2 hunks)
💤 Files with no reviewable changes (1)
- components/stripe/actions/create-usage-record/create-usage-record.mjs
✅ Files skipped from review due to trivial changes (4)
- components/stripe/actions/create-product/create-product.mjs
- components/stripe/actions/create-payout/create-payout.mjs
- components/stripe/actions/update-payment-intent/update-payment-intent.mjs
- components/stripe/actions/create-price/create-price.mjs
🚧 Files skipped from review as they are similar to previous changes (46)
- components/stripe/actions/retrieve-invoice/retrieve-invoice.mjs
- components/stripe/actions/write-off-invoice/write-off-invoice.mjs
- components/stripe/actions/delete-customer/delete-customer.mjs
- components/stripe/actions/update-refund/update-refund.mjs
- components/stripe/sources/abandoned-cart/abandoned-cart.mjs
- components/stripe/actions/retrieve-invoice-item/retrieve-invoice-item.mjs
- components/stripe/actions/finalize-invoice/finalize-invoice.mjs
- components/stripe/actions/retrieve-balance/retrieve-balance.mjs
- components/stripe/actions/retrieve-payout/retrieve-payout.mjs
- components/stripe/package.json
- components/stripe/sources/canceled-subscription/canceled-subscription.mjs
- components/stripe/sources/new-failed-invoice-payment/new-failed-invoice-payment.mjs
- components/stripe/actions/delete-invoice-item/delete-invoice-item.mjs
- components/stripe/actions/send-invoice/send-invoice.mjs
- components/stripe/sources/new-customer/new-customer.mjs
- components/stripe/actions/create-refund/create-refund.mjs
- components/stripe/actions/retrieve-checkout-session/retrieve-checkout-session.mjs
- components/stripe/actions/void-invoice/void-invoice.mjs
- components/stripe/actions/retrieve-payment-intent/retrieve-payment-intent.mjs
- components/stripe/actions/retrieve-product/retrieve-product.mjs
- components/stripe/sources/new-invoice/new-invoice.mjs
- components/stripe/actions/delete-or-void-invoice/delete-or-void-invoice.mjs
- components/stripe/actions/retrieve-refund/retrieve-refund.mjs
- components/stripe/actions/create-customer/create-customer.mjs
- components/stripe/actions/cancel-or-reverse-payout/cancel-or-reverse-payout.mjs
- components/stripe/sources/new-dispute/new-dispute.mjs
- components/stripe/actions/retrieve-price/retrieve-price.mjs
- components/stripe/actions/update-payout/update-payout.mjs
- components/stripe/actions/cancel-payment-intent/cancel-payment-intent.mjs
- components/stripe/actions/retrieve-checkout-session-line-items/retrieve-checkout-session-line-items.mjs
- components/stripe/actions/update-customer/update-customer.mjs
- components/stripe/sources/subscription-updated/subscription-updated.mjs
- components/stripe/sources/new-subscription/new-subscription.mjs
- components/stripe/actions/list-refunds/list-refunds.mjs
- components/stripe/actions/update-invoice-item/update-invoice-item.mjs
- components/stripe/sources/new-failed-payment/new-failed-payment.mjs
- components/stripe/actions/retrieve-customer/retrieve-customer.mjs
- components/stripe/actions/create-payment-intent/create-payment-intent.mjs
- components/stripe/sources/new-payment/new-payment.mjs
- components/stripe/sources/custom-webhook-events/custom-webhook-events.mjs
- components/stripe/actions/create-invoice/create-invoice.mjs
- components/stripe/actions/confirm-payment-intent/confirm-payment-intent.mjs
- components/stripe/actions/create-subscription/create-subscription.mjs
- components/stripe/actions/capture-payment-intent/capture-payment-intent.mjs
- components/stripe/actions/update-invoice/update-invoice.mjs
- components/stripe/actions/list-payment-intents/list-payment-intents.mjs
🔇 Additional comments (31)
components/stripe/common/utils.mjs (2)
1-22
: Well-structured recursive JSON parsing implementationThis is a solid implementation of a recursive JSON parser that handles nested objects and strings. The recursion is implemented correctly with proper error handling.
33-41
: Clean utility export with additional validationGood approach wrapping the parseJson function with extra validation to ensure it always returns an object. This provides a consistent interface for consumers of this utility.
components/stripe/actions/create-invoice-item/create-invoice-item.mjs (3)
3-3
: Good addition of utility importAdding the utils import enables consistent parsing of JSON options across Stripe actions.
9-9
: Version increment reflects API changesAppropriate version increment from 0.1.1 to 0.1.2 to reflect the changes in implementation.
87-113
:❓ Verification inconclusive
Updated to use new Stripe SDK structure
The changes correctly adapt to the new Stripe SDK structure by:
- Destructuring props more cleanly
- Using the nested
pricing
object structure for price- Properly parsing the advanced options with utils.parseJson
These changes align with Stripe's latest API version requirements.
One thing to verify:
🏁 Script executed:
#!/bin/bash # Check Stripe API docs to understand the proper structure for invoice item creation curl -s https://api.stripe.com/v1/invoiceitems | grep -A 5 pricingLength of output: 68
Please verify the
pricing
parameter structureThe changes correctly adapt to the new Stripe SDK structure by:
- Destructuring props more cleanly
- Using the nested
pricing
object forprice
- Properly parsing the advanced options with
utils.parseJson
Before approving, confirm that
InvoiceItems.create()
in the latest Stripe Node.js SDK supports:...(price ? { pricing: { price, }, } : {} ),File: components/stripe/actions/create-invoice-item/create-invoice-item.mjs
Lines: 87–113components/stripe/actions/create-billing-meter/create-billing-meter.mjs (2)
3-9
: Well-structured new Billing Meter componentGood implementation of the new Billing Meter component with proper metadata. The description clearly explains the purpose and links to relevant documentation.
9-68
: Comprehensive props configurationThe props are well-defined with clear descriptions, appropriate types, and useful options for dropdowns. The optional flags are correctly applied where needed.
components/stripe/actions/list-balance-history/list-balance-history.mjs (5)
2-2
: Added utils import for date conversionGood addition of the utils import to leverage the date conversion functionality.
8-8
: Significant version incrementThe version has been updated from 0.1.1 to 0.1.6, which is a larger jump than other files. This is appropriate given the number of new filtering and pagination features added.
22-28
: Default country addition for currencyAdded a default country of "US" for the currency prop, which improves usability by providing a sensible default.
42-77
: Enhanced filtering and pagination capabilitiesThe added props for date-based filtering (createdGt, createdGte, createdLt, createdLte) and pagination (endingBefore, startingAfter) significantly improve the action's flexibility.
79-114
: Well-implemented filtering logicThe refactored run method correctly:
- Destructures properties for better readability
- Conditionally includes date filters only when needed
- Properly converts date strings to integer timestamps
- Includes pagination parameters directly
This implementation aligns with Stripe API expectations while providing a clean interface.
components/stripe/actions/list-customers/list-customers.mjs (5)
2-2
: Good addition of utility module import.The utils module import is a welcome addition that allows for reusable functionality across different actions.
8-9
: Appropriate version bump and description update.The version increment from 0.1.1 to 0.1.2 appropriately reflects the enhancement of the component with additional filtering capabilities. The updated description also provides clearer documentation reference.
25-60
: Great enhancement with additional filtering and pagination options.The addition of date range filters and pagination parameters significantly improves the component's flexibility and aligns with Stripe's API capabilities. These props will allow users to create more targeted queries and handle large result sets more efficiently.
63-74
: Good refactoring to use direct destructuring.Replacing lodash.pick with direct destructuring makes the code more modern and removes an external dependency, which is a good practice.
75-93
: Clean implementation of conditional date filtering.The implementation of date filtering and cursor-based pagination is clean and well-structured. The conditional construction of the created filter object only when needed is an efficient approach. The use of utils.fromDateToInteger ensures proper conversion of ISO date strings to the UNIX timestamps required by Stripe's API.
components/stripe/actions/list-invoices/list-invoices.mjs (5)
2-2
: Good addition of utility module import.Consistent with other actions, adding the utils module import enables reuse of common functions.
8-8
: Appropriate version bump.The version increment from 0.1.1 to 0.1.2 correctly reflects the enhancement nature of these changes.
49-84
: Great enhancement with filtering and pagination options.Adding date range filters and pagination parameters provides users with more control over their queries, especially useful for accounts with many invoices.
87-100
: Good refactoring to use direct property destructuring.The refactoring from lodash.pick to direct destructuring improves code readability and removes an external dependency.
102-123
: Well-implemented date filtering logic.The conditional construction of the date filtering parameters is clean and efficient, only adding the filter when at least one date parameter is provided. The conversion from ISO dates to UNIX timestamps using the utility function maintains consistency across the codebase.
components/stripe/stripe.app.mjs (3)
1-1
: Updated Stripe SDK import style.Changed from default import to named import, which aligns with the newer versions of the Stripe SDK.
642-701
: Excellent addition of filtering and pagination prop definitions.The comprehensive set of new prop definitions for date filtering (created and arrival dates) and cursor-based pagination significantly enhances the capabilities of all Stripe actions. The detailed descriptions will help users understand how to use these parameters correctly.
707-709
:❌ Incorrect review comment
Updated Stripe SDK instantiation and API version.
The change to use constructor-style instantiation (
new Stripe
) and updating the API version are key parts of this upgrade.However, the API version
"2025-03-31.basil"
seems unusual with its future date and.basil
suffix.
🌐 Web query:
What is the latest stable Stripe API version? Is "2025-03-31.basil" a valid Stripe API version?
💡 Result:
The latest stable Stripe API version is 2025-04-30.basil[1][2]. This is the current version as documented in Stripe's API reference.
Yes, "2025-03-31.basil" is a valid Stripe API version. It was the previous stable version before the latest update[8][10]. Stripe follows a versioning system where they release new API versions monthly with no breaking changes, and "basil" refers to the major release name[5]. Each version is named with the date it was released (in this case, March 31, 2025, for the previous version and April 30, 2025, for the current version).
How Stripe Versioning Works
Stripe's API versioning follows a specific pattern:
- Monthly releases that include only backward-compatible changes
- Major releases (like "basil") twice a year that may include breaking changes[5]
- Each version is named with its release date followed by the major release name
When integrating with Stripe, you can specify which API version to use by:
- Setting it globally in your SDK initialization
- Setting it per request using the
Stripe-Version
header- Using your account's default version set in Workbench[3]
For example, you can specify the version in a curl request:
curl https://api.stripe.com/v1/charges \ -u : \ -H "Stripe-Version: 2025-04-30.basil"Or when initializing the Node.js library:
const stripe = require('stripe')('', { apiVersion: '2025-04-30.basil', });It's generally recommended to explicitly set your API version in code rather than relying on your account's default version to ensure consistent behavior as you develop and maintain your application[3].
Citations:
- 1: https://docs.stripe.com/api/versioning
- 2: https://docs.stripe.com/api/versioning?lang=node
- 3: https://docs.stripe.com/upgrades
- 4: https://docs.stripe.com/sdks/set-version
- 5: https://docs.stripe.com/sdks/versioning
- 6: https://stripe.com/blog/api-versioning
- 7: https://classic.yarnpkg.com/en/package/stripe
- 8: https://github.com/stripe/stripe-java/releases
- 9: https://stripe.dev/blog/prepare-for-api-upgrades
- 10: https://github.com/stripe/stripe-dotnet/blob/master/CHANGELOG.md
Stripe API version validity
The API version
"2025-03-31.basil"
is valid—it corresponds to Stripe’s March 31, 2025 release (Stripe uses YYYY-MM-DD plus a release name). If you’d rather target the very latest stable release, you can bump this to"2025-04-30.basil"
, but using"2025-03-31.basil"
is perfectly acceptable.Likely an incorrect or invalid review comment.
components/stripe/actions/list-payouts/list-payouts.mjs (6)
2-2
: Good addition of utility module import.The utils module import enables reuse of date conversion functionality across different actions.
8-8
: Appropriate version increment.The version bump from 0.1.1 to 0.1.2 properly reflects the enhancement nature of these changes.
25-90
: Comprehensive enhancement with filtering and pagination options.The addition of creation date filters, arrival date filters, destination filtering, and pagination parameters significantly improves the component's flexibility. This is especially useful for accounts with many payouts that need to be filtered by different criteria.
93-108
: Good refactoring to use direct property destructuring.The refactoring from lodash.pick to direct destructuring makes the code more readable and maintainable.
110-138
: Well-implemented filtering logic with conditional parameters.The implementation of date filtering (for both created and arrival_date) is clean and efficient. The conditional construction of filter objects only when needed reduces unnecessary parameters in the API call. The use of the utility function for date conversion ensures consistency across the codebase.
144-144
: Improved summary message with conditional formatting.The updated summary message that conditionally includes the status when available provides more relevant feedback to the user.
WHY
Resolves #16415 and #16554
Summary by CodeRabbit