Allow creation of Stripe subscriptions without a quantity / seats #1715

Closed
opened 2026-03-13 08:58:06 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @m90 on GitHub (Aug 15, 2025).

Is this suited for github?

  • Yes, this is suited for github

I would like to use BetterAuth to manage Stripe subscriptions for plans with prices that use metered billing. Stripe API expects such a subscription to be created without a quantity in its line items, however BetterAuth force sets a quantity of 1 if I omit the seats field from my upgradeSubscription call, resulting in an error like:

Quantity should not be specified where usage_type is metered. Remove quantity from line_items[0]

I also cannot set seats to anything special that would allow me to disable this behavior.

Describe the solution you'd like

Hacky: when passing null or -1 to seats, quantity is omitted from the line item

Proper: allow definition of plans as metered which drops the quantity from the line items.

Describe alternatives you've considered

Not using Better auth or not calling upgradeSubscription but instead use the Stripe SDK and try to mimic all of the database logic that needs to happen afterwards.

Additional context

This is not about a full integration of Stripe metering features in Better Auth. I would be fine to collect these events myself using plain Stripe SDK.

Originally created by @m90 on GitHub (Aug 15, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### Is your feature request related to a problem? Please describe. I would like to use BetterAuth to manage Stripe subscriptions for plans with prices that use metered billing. Stripe API expects such a subscription to be created without a quantity in its line items, however BetterAuth force sets a quantity of 1 if I omit the `seats` field from my `upgradeSubscription` call, resulting in an error like: > Quantity should not be specified where usage_type is `metered`. Remove quantity from `line_items[0]` I also cannot set `seats` to anything special that would allow me to disable this behavior. ### Describe the solution you'd like Hacky: when passing `null` or `-1` to `seats`, quantity is omitted from the line item Proper: allow definition of plans as `metered` which drops the quantity from the line items. ### Describe alternatives you've considered Not using Better auth or not calling `upgradeSubscription` but instead use the Stripe SDK and try to mimic all of the database logic that needs to happen afterwards. ### Additional context This is not about a full integration of Stripe metering features in Better Auth. I would be fine to collect these events myself using plain Stripe SDK.
GiteaMirror added the enhancement label 2026-03-13 08:58:06 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 15, 2025):

BetterAuth currently always sets a quantity (via the seats field) when creating or upgrading Stripe subscriptions, defaulting to 1 if not provided. This causes Stripe API errors for metered billing plans, which require the quantity field to be omitted. There is no built-in way to define a plan as metered or to suppress the quantity field—passing null or -1 for seats does not work, and all logic regarding line item quantity is handled in the Stripe integration code, specifically in packages/stripe/src/subscription.ts (and related logic in index.ts), where quantity is always set unless you patch the code yourself cite.

A possible workaround is to fork BetterAuth and modify the subscription logic to omit the quantity field when handling metered plans (for example, by adding a metered property to your plan definition and conditionally skipping the quantity assignment in the relevant code). There is currently no documented or supported way to do this out of the box cite.

If you need this feature immediately, you would need to either patch BetterAuth as described or use the Stripe SDK directly and manually replicate any necessary database logic.

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 (Aug 15, 2025): <!-- Answer --> BetterAuth currently always sets a quantity (via the `seats` field) when creating or upgrading Stripe subscriptions, defaulting to 1 if not provided. This causes Stripe API errors for metered billing plans, which require the quantity field to be omitted. There is no built-in way to define a plan as metered or to suppress the quantity field—passing `null` or `-1` for `seats` does not work, and all logic regarding line item quantity is handled in the Stripe integration code, specifically in `packages/stripe/src/subscription.ts` (and related logic in `index.ts`), where quantity is always set unless you patch the code yourself [cite](https://github.com/better-auth/better-auth/pull/3554). A possible workaround is to fork BetterAuth and modify the subscription logic to omit the quantity field when handling metered plans (for example, by adding a `metered` property to your plan definition and conditionally skipping the quantity assignment in the relevant code). There is currently no documented or supported way to do this out of the box [cite](https://github.com/better-auth/better-auth/pull/2930). If you need this feature immediately, you would need to either patch BetterAuth as described or use the Stripe SDK directly and manually replicate any necessary database logic. <!-- 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/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/c80d1d70-0000-4a85-aef2-812f1dec24bc?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/4025)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1715