[PR #4607] [CLOSED] fix(stripe): Closes #3979 #22382

Closed
opened 2026-04-15 21:00:31 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4607
Author: @jonathankfmn
Created: 9/12/2025
Status: Closed

Base: canaryHead: canary


📝 Commits (2)

  • 1201a8e fix(stripe): only update Subscription if subscriptionId is provided. (#3979)
  • 011d4d9 fix: remove comment

📊 Changes

1 file changed (+15 additions, -14 deletions)

View changed files

📝 packages/stripe/src/index.ts (+15 -14)

📄 Description

Problem:
Users were unable to create multiple subscriptions for different organizations, even when using
different referenceId values. The system incorrectly forced users into an upgrade flow for any
existing subscription, regardless of the organization context.

Solution:
Modified the subscription logic to:

  • Only set subscriptionToUpdate when an explicit subscriptionId is provided (removed the automatic lookup by referenceId)
  • Only trigger the upgrade flow when explicitly updating an existing subscription

Summary by cubic

Fixes subscription creation across multiple organizations by removing implicit referenceId lookups and only triggering upgrades when explicitly updating a known subscription. This prevents users from being forced into upgrading an unrelated subscription.

  • Bug Fixes
    • Only set subscriptionToUpdate when a subscriptionId is provided (no automatic lookup by referenceId).
    • Only consider an activeSubscription when updating a known subscription.
    • Show “already subscribed” only if plan, seats, and referenceId all match.
    • Trigger billing portal/upgrade flow only when subscriptionId or subscriptionToUpdate is present.

🔄 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/4607 **Author:** [@jonathankfmn](https://github.com/jonathankfmn) **Created:** 9/12/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `canary` --- ### 📝 Commits (2) - [`1201a8e`](https://github.com/better-auth/better-auth/commit/1201a8e7a927a5883c070aaa21a8ef8497d1373c) fix(stripe): only update Subscription if subscriptionId is provided. (#3979) - [`011d4d9`](https://github.com/better-auth/better-auth/commit/011d4d9f82413e91c467117ba8c263332d90bdc0) fix: remove comment ### 📊 Changes **1 file changed** (+15 additions, -14 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/index.ts` (+15 -14) </details> ### 📄 Description **Problem:** Users were unable to create multiple subscriptions for different organizations, even when using different referenceId values. The system incorrectly forced users into an upgrade flow for any existing subscription, regardless of the organization context. **Solution:** Modified the subscription logic to: - Only set subscriptionToUpdate when an explicit subscriptionId is provided (removed the automatic lookup by referenceId) - Only trigger the upgrade flow when explicitly updating an existing subscription <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fixes subscription creation across multiple organizations by removing implicit referenceId lookups and only triggering upgrades when explicitly updating a known subscription. This prevents users from being forced into upgrading an unrelated subscription. - **Bug Fixes** - Only set subscriptionToUpdate when a subscriptionId is provided (no automatic lookup by referenceId). - Only consider an activeSubscription when updating a known subscription. - Show “already subscribed” only if plan, seats, and referenceId all match. - Trigger billing portal/upgrade flow only when subscriptionId or subscriptionToUpdate is present. <!-- End of auto-generated description by cubic. --> --- <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-04-15 21:00:31 -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#22382