[Stripe Plugin] Feature Request: Plan limits should support diverse types (not just numbers) #2044

Closed
opened 2026-03-13 09:22:50 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @MickeyKay on GitHub (Sep 30, 2025).

Is this suited for github?

  • Yes, this is suited for github

Stripe plan limits are currently typed as Record<string, number> (reference).

This makes sense from the perspective of pure numeric limits (e.g. maxResources: 5), however there are at least a few other use cases that make much more sense for non-numeric values (e.g. supportedRequestMethods: ['HEAD', 'GET', 'POST']).

Is there any reason the limits type definition couldn't be expanded to Record<string, any>?

Describe the solution you'd like

Based on my digging (and @dosu 's help), it sure looks like plan limits are not integrated in any way with Stripe functionality, nor seem to have any integration with core Better Auth functionality. Rather it seems they are simply a convenience to help developers define some of their plan-dependent business functionality within the same plan definition that is used to integrate with Stripe. If this is indeed the case, it seems like expanding the type definition would be completely backwards compatible, and would enable folks like myself to continue using the limits feature provided by Better Auth, instead of having to keep a parallel planLimits definition of my own with more flexible limit/feature type definitions.

Describe alternatives you've considered

At present, I'm doing the following, which is problematic for a few reasons:

limits: {
  requestMethodHEAD: 1,
  requestMethodGET: 1,
  requestMethodPOST: 1,
},
  1. It requires referencing each limit individually, as opposed to a grouped set of related values within a single limit definition (e.g. can't do limits.requestMethods.includes(...)
  2. It is cumbersome when scaling to LOTS of supported values

Additional context

No response

Originally created by @MickeyKay on GitHub (Sep 30, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. Stripe plan limits are currently typed as `Record<string, number>` ([reference](https://github.com/better-auth/better-auth/blob/main/packages/stripe/src/types.ts#L43)). This makes sense from the perspective of pure numeric limits (e.g. `maxResources: 5`), however there are at least a few other use cases that make much more sense for non-numeric values (e.g. `supportedRequestMethods: ['HEAD', 'GET', 'POST']`). Is there any reason the `limits` type definition couldn't be expanded to `Record<string, any>`? ### Describe the solution you'd like Based on my digging (and @dosu 's help), it sure looks like plan `limits` are _not_ integrated in any way with Stripe functionality, nor seem to have any integration with core Better Auth functionality. Rather it seems they are simply a convenience to help developers define some of their plan-dependent business functionality within the same plan definition that is used to integrate with Stripe. If this is indeed the case, it seems like expanding the type definition would be completely backwards compatible, and would enable folks like myself to continue using the `limits` feature provided by Better Auth, instead of having to keep a parallel `planLimits` definition of my own with more flexible limit/feature type definitions. ### Describe alternatives you've considered At present, I'm doing the following, which is problematic for a few reasons: ``` limits: { requestMethodHEAD: 1, requestMethodGET: 1, requestMethodPOST: 1, }, ``` 1. It requires referencing each limit individually, as opposed to a grouped set of related values within a single limit definition (e.g. can't do `limits.requestMethods.includes(...)` 2. It is cumbersome when scaling to LOTS of supported values ### Additional context _No response_
GiteaMirror added the enhancement label 2026-03-13 09:22:50 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 30, 2025):

There’s no technical or architectural reason the Stripe plan limits type needs to stay as Record<string, number>. The codebase treats limits as a developer convenience—it's just attached to plan objects and passed through API responses, with no logic that assumes numeric values or enforces any structure beyond the type annotation itself. There’s no integration with Stripe or core Better Auth features that would be affected by making this more flexible. Expanding the type to Record<string, any> is safe and backwards compatible based on current usage, and would make it much easier to group related values or support non-numeric limits as you described. The only caveat is that if you or others rely on numeric-only logic, you’ll want to add your own type guards or validation after the change. This update would improve flexibility and scalability for plan configuration without breaking existing functionality.
Reference: StripePlan type definition and usage

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 30, 2025): <!-- Answer --> There’s no technical or architectural reason the Stripe plan `limits` type needs to stay as `Record<string, number>`. The codebase treats `limits` as a developer convenience—it's just attached to plan objects and passed through API responses, with no logic that assumes numeric values or enforces any structure beyond the type annotation itself. There’s no integration with Stripe or core Better Auth features that would be affected by making this more flexible. Expanding the type to `Record<string, any>` is safe and backwards compatible based on current usage, and would make it much easier to group related values or support non-numeric limits as you described. The only caveat is that if you or others rely on numeric-only logic, you’ll want to add your own type guards or validation after the change. This update would improve flexibility and scalability for plan configuration without breaking existing functionality. [Reference: StripePlan type definition and usage](https://github.com/better-auth/better-auth/blob/f6cbdcc84ee5d2971fdcc8b23ff7c174f88cf45b/packages/stripe/src/types.ts) <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/bf8591b0-1d2f-46f2-b199-7526c99555ad?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4977)
Author
Owner

@MickeyKay commented on GitHub (Sep 30, 2025):

@dosu Great, what's the next step to have this considered for feature development?

@MickeyKay commented on GitHub (Sep 30, 2025): @dosu Great, what's the next step to have this considered for feature development?
Author
Owner

@dosubot[bot] commented on GitHub (Sep 30, 2025):

There’s no published workflow or official process for feature request triage in Better Auth, but your request is now visible to maintainers and will be considered as part of their review and prioritization process. To help move things forward, you can add more context—such as additional use cases, implementation ideas, or examples of how this change would benefit real projects. Keep an eye on this thread for any follow-up questions or feedback from maintainers, and be ready to clarify or discuss as needed.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 30, 2025): <!-- Answer --> There’s no published workflow or official process for feature request triage in Better Auth, but your request is now visible to maintainers and will be considered as part of their review and prioritization process. To help move things forward, you can add more context—such as additional use cases, implementation ideas, or examples of how this change would benefit real projects. Keep an eye on this thread for any follow-up questions or feedback from maintainers, and be ready to clarify or discuss as needed. <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/17e7e6be-9f21-48e6-9762-3199a501ffc9?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4977)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#2044