[PR #4499] [MERGED] fix(stripe): properly resolve plans by lookup keys #5411

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

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/4499
Author: @AlexProgrammerDE
Created: 9/7/2025
Status: Merged
Merged: 9/9/2025
Merged by: @himself65

Base: canaryHead: fix/resolve-lookup-keys


📝 Commits (1)

  • 5fe9f69 fix: properly resolve plans by lookup keys

📊 Changes

3 files changed (+21 additions, -8 deletions)

View changed files

📝 packages/stripe/src/hooks.ts (+10 -3)
📝 packages/stripe/src/index.ts (+4 -3)
📝 packages/stripe/src/utils.ts (+7 -2)

📄 Description

the previous behaviour would ignore all events for packages with lookup keys instead of price ids

getPlanByPriceId(options, stripeSubscription.items.data[0]?.plan.id); in index.ts was also incorrect because a price id was expected, but a plan id provided.


Summary by cubic

Fix plan resolution in Stripe to support price lookup keys and use the correct price.id, so checkout and subscription events map to the right plan. This restores event handling for packages using lookup keys.

  • Bug Fixes
    • Replaced getPlanByPriceId with getPlanByPriceInfo(priceId, lookupKey) and updated callers in hooks and index.
    • Corrected index.ts to pass price.id instead of plan.id.
    • Plan matching now checks priceId, annualDiscountPriceId, lookupKey, and annualDiscountLookupKey.

🔄 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/4499 **Author:** [@AlexProgrammerDE](https://github.com/AlexProgrammerDE) **Created:** 9/7/2025 **Status:** ✅ Merged **Merged:** 9/9/2025 **Merged by:** [@himself65](https://github.com/himself65) **Base:** `canary` ← **Head:** `fix/resolve-lookup-keys` --- ### 📝 Commits (1) - [`5fe9f69`](https://github.com/better-auth/better-auth/commit/5fe9f69019f8e34c1b8abb7b3829a782395fbadf) fix: properly resolve plans by lookup keys ### 📊 Changes **3 files changed** (+21 additions, -8 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/hooks.ts` (+10 -3) 📝 `packages/stripe/src/index.ts` (+4 -3) 📝 `packages/stripe/src/utils.ts` (+7 -2) </details> ### 📄 Description the previous behaviour would ignore all events for packages with lookup keys instead of price ids `getPlanByPriceId(options, stripeSubscription.items.data[0]?.plan.id);` in index.ts was also incorrect because a price id was expected, but a plan id provided. <!-- This is an auto-generated description by cubic. --> --- ## Summary by cubic Fix plan resolution in Stripe to support price lookup keys and use the correct price.id, so checkout and subscription events map to the right plan. This restores event handling for packages using lookup keys. - **Bug Fixes** - Replaced getPlanByPriceId with getPlanByPriceInfo(priceId, lookupKey) and updated callers in hooks and index. - Corrected index.ts to pass price.id instead of plan.id. - Plan matching now checks priceId, annualDiscountPriceId, lookupKey, and annualDiscountLookupKey. <!-- 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:21:58 -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#5411