[PR #2366] [MERGED] feat: migrate to stripe sdk v18.0.0 #4281

Closed
opened 2026-03-13 11:40:23 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/2366
Author: @kkMihai
Created: 4/19/2025
Status: Merged
Merged: 4/22/2025
Merged by: @Bekacru

Base: mainHead: feat/stripe-update-v18


📝 Commits (3)

📊 Changes

4 files changed (+136 additions, -136 deletions)

View changed files

📝 packages/stripe/package.json (+4 -3)
📝 packages/stripe/src/hooks.ts (+15 -6)
📝 packages/stripe/src/index.ts (+4 -2)
📝 pnpm-lock.yaml (+113 -125)

📄 Description

ℹ️ This PR also resolves a rare edge case where purchasing a plan would occasionally overwrite another plan tied to a different organization if purchased by the same user.

Dependency Updates

  • Updated the stripe package from version ^17.7.0 to ^18.0.0 in packages/stripe/package.json and pnpm-lock.yaml to use the latest features and improvements. [1] [2] [3]
  • Updated @types/bun and bun-types from version 1.2.9 to 1.2.10 in pnpm-lock.yaml to incorporate the latest type definitions. [1] [2]

Code Refactoring

  • Reordered imports in packages/stripe/src/hooks.ts and packages/stripe/src/index.ts for better readability and consistency. [1] [2]

Stripe Subscription Period Handling

  • Updated the logic for calculating periodStart and periodEnd in multiple functions (onCheckoutSessionCompleted, onSubscriptionUpdated, and stripe) to use subscription.items.data[0] instead of directly accessing the subscription object. This ensures compatibility with the updated Stripe API. [1] [2] [3]

Minor Adjustments

  • Added explicit typing to the activeSub filter function in onSubscriptionUpdated for better type safety.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/better-auth/better-auth/pull/2366 **Author:** [@kkMihai](https://github.com/kkMihai) **Created:** 4/19/2025 **Status:** ✅ Merged **Merged:** 4/22/2025 **Merged by:** [@Bekacru](https://github.com/Bekacru) **Base:** `main` ← **Head:** `feat/stripe-update-v18` --- ### 📝 Commits (3) - [`7eceb6a`](https://github.com/better-auth/better-auth/commit/7eceb6a967f35a3dc4df3eb57e98d94fc015c3a9) feat: migrate to stripe sdk v18.0.0 - [`ebfedac`](https://github.com/better-auth/better-auth/commit/ebfedac674eafa1923e073ca2ba063b87105f38e) chore: lint - [`33ee2ad`](https://github.com/better-auth/better-auth/commit/33ee2ad4c01c628422f13578e5ef0ce2e3c61434) chore: fix type ### 📊 Changes **4 files changed** (+136 additions, -136 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/package.json` (+4 -3) 📝 `packages/stripe/src/hooks.ts` (+15 -6) 📝 `packages/stripe/src/index.ts` (+4 -2) 📝 `pnpm-lock.yaml` (+113 -125) </details> ### 📄 Description ### ℹ️ This PR also resolves a rare edge case where purchasing a plan would occasionally overwrite another plan tied to a different organization if purchased by the same user. ### Dependency Updates * Updated the `stripe` package from version `^17.7.0` to `^18.0.0` in `packages/stripe/package.json` and `pnpm-lock.yaml` to use the latest features and improvements. [[1]](diffhunk://#diff-2757b5358a7885372a3e494ce4ec980483ceda7522dd1b61eb52e151772ac9e1R47-R50) [[2]](diffhunk://#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL1669-R1670) [[3]](diffhunk://#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL18650-R18647) * Updated `@types/bun` and `bun-types` from version `1.2.9` to `1.2.10` in `pnpm-lock.yaml` to incorporate the latest type definitions. [[1]](diffhunk://#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL361-R361) [[2]](diffhunk://#diff-32824c984905bb02bc7ffcef96a77addd1f1602cff71a11fbbfdd7f53ee026bbL10723-R10724) ### Code Refactoring * Reordered imports in `packages/stripe/src/hooks.ts` and `packages/stripe/src/index.ts` for better readability and consistency. [[1]](diffhunk://#diff-72e8dafae00019b1cb067d0577a11924409d13aacf09333fcd9406aa5389b8f4L1-R1) [[2]](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08L2-R13) ### Stripe Subscription Period Handling * Updated the logic for calculating `periodStart` and `periodEnd` in multiple functions (`onCheckoutSessionCompleted`, `onSubscriptionUpdated`, and `stripe`) to use `subscription.items.data[0]` instead of directly accessing the subscription object. This ensures compatibility with the updated Stripe API. [[1]](diffhunk://#diff-72e8dafae00019b1cb067d0577a11924409d13aacf09333fcd9406aa5389b8f4L44-R49) [[2]](diffhunk://#diff-72e8dafae00019b1cb067d0577a11924409d13aacf09333fcd9406aa5389b8f4L141-R151) [[3]](diffhunk://#diff-ccb5282d4490ceec8e8c99f978be2383dd1915db21316f3baba6066420070b08L834-R839) ### Minor Adjustments * Added explicit typing to the `activeSub` filter function in `onSubscriptionUpdated` for better type safety. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-03-13 11:40:23 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#4281