[PR #5167] [CLOSED] fix(stripe): allow subscription upgrade between different intervals for a plan #5820

Closed
opened 2026-03-13 12:37:38 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/5167
Author: @andrewdoro
Created: 10/8/2025
Status: Closed

Base: canaryHead: fix/upgrade-subscription-interval


📝 Commits (4)

  • c29ae5f fix(stripe): allow subscription upgrade between different intervals for a plan
  • ed05756 feat: add test for annual plan switch
  • 871507e fix: pass same id as the mock price list
  • 197e773 chore: fix types related ai review

📊 Changes

2 files changed (+127 additions, -38 deletions)

View changed files

📝 packages/stripe/src/index.ts (+24 -38)
📝 packages/stripe/src/stripe.test.ts (+103 -0)

📄 Description

This PR enables upgrades for subscriptions on the same plan between different billing intervals. (annually/monthly)

  • Deduplicates priceId checks for lookup keys and moves them before ALREADY_SUBSCRIBED_PLAN check
  • Implements checks for priceId by using the active priceId from the current active stripe subscription and the future priceId of the upgrade.
  • Adds test for switching to annually for same plan

fixes #3393 #3236


Summary by cubic

Allows upgrading a subscription between monthly and annual intervals on the same plan. Prevents false “already subscribed” errors by comparing Stripe price IDs correctly.

  • Bug Fixes
    • Resolve price ID (including lookup keys) before the already-subscribed check and deduplicate logic.
    • Compare the active Stripe subscription’s price ID to the target price ID to allow interval switches.
    • Add test covering monthly-to-annual upgrade on the same plan.

🔄 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/5167 **Author:** [@andrewdoro](https://github.com/andrewdoro) **Created:** 10/8/2025 **Status:** ❌ Closed **Base:** `canary` ← **Head:** `fix/upgrade-subscription-interval` --- ### 📝 Commits (4) - [`c29ae5f`](https://github.com/better-auth/better-auth/commit/c29ae5f8d8ae19346efe34ae6940cc4598a7f1a2) fix(stripe): allow subscription upgrade between different intervals for a plan - [`ed05756`](https://github.com/better-auth/better-auth/commit/ed05756635c7e4fa279e9b0dda2acf2772eea90c) feat: add test for annual plan switch - [`871507e`](https://github.com/better-auth/better-auth/commit/871507ecece31d76c6419ee46cad20a1fc798275) fix: pass same id as the mock price list - [`197e773`](https://github.com/better-auth/better-auth/commit/197e773e96d5bb136ca6b25c4dd4209e5c6bea96) chore: fix types related ai review ### 📊 Changes **2 files changed** (+127 additions, -38 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/index.ts` (+24 -38) 📝 `packages/stripe/src/stripe.test.ts` (+103 -0) </details> ### 📄 Description This PR enables upgrades for subscriptions on the same plan between different billing intervals. (annually/monthly) - Deduplicates priceId checks for lookup keys and moves them before `ALREADY_SUBSCRIBED_PLAN` check - Implements checks for `priceId` by using the active priceId from the current active stripe subscription and the future priceId of the upgrade. - Adds test for switching to annually for same plan fixes #3393 #3236 <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Allows upgrading a subscription between monthly and annual intervals on the same plan. Prevents false “already subscribed” errors by comparing Stripe price IDs correctly. - **Bug Fixes** - Resolve price ID (including lookup keys) before the already-subscribed check and deduplicate logic. - Compare the active Stripe subscription’s price ID to the target price ID to allow interval switches. - Add test covering monthly-to-annual upgrade on the same plan. <!-- 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-03-13 12:37:38 -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#5820