[PR #8926] [MERGED] fix(stripe): omit quantity for metered prices in checkout and upgrades #25202

Closed
opened 2026-04-15 22:45:47 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/8926
Author: @bytaesu
Created: 4/3/2026
Status: Merged
Merged: 4/10/2026
Merged by: @bytaesu

Base: mainHead: 2026-04-03/fix/stripe-metered-quantity


📝 Commits (5)

  • 6ad72be fix(stripe): omit quantity for metered prices in checkout and upgrades
  • a33e204 refactor(stripe): rename metered to isMetered for consistency
  • 0908702 fix(stripe): fall back to priceId when lookupKey resolves to nothing
  • c90ae3d Merge branch 'main' into 2026-04-03/fix/stripe-metered-quantity
  • 5c85f4a chore: add changeset for PR #8926

📊 Changes

5 files changed (+657 additions, -25 deletions)

View changed files

.changeset/pr-8926.md (+5 -0)
📝 packages/stripe/src/routes.ts (+59 -25)
📝 packages/stripe/test/seat-based-billing.test.ts (+6 -0)
📝 packages/stripe/test/stripe-organization.test.ts (+12 -0)
📝 packages/stripe/test/stripe.test.ts (+575 -0)

📄 Description

Note

Subscriptions have two kinds of usage-based billing: metered and per-seat licensing. You can enable these billing models by setting the value of the recurring[usage_type] attribute when creating a price. You can only specify a quantity when creating a subscription with a recurring[usage_type] of licensed. If you want to have granular billing for usage that fluctuates within a billing interval, consider using usage-based billing instead of quantities.

https://docs.stripe.com/billing/subscriptions/quantities#multiple-quantities-sub

The current model doesn't support "metered-only" directly. It was possible via a workaround by setting the base price to free. This PR improves that.


🔄 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/8926 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 4/3/2026 **Status:** ✅ Merged **Merged:** 4/10/2026 **Merged by:** [@bytaesu](https://github.com/bytaesu) **Base:** `main` ← **Head:** `2026-04-03/fix/stripe-metered-quantity` --- ### 📝 Commits (5) - [`6ad72be`](https://github.com/better-auth/better-auth/commit/6ad72be69617334da91ae82f2b01a3d40dc9fddb) fix(stripe): omit quantity for metered prices in checkout and upgrades - [`a33e204`](https://github.com/better-auth/better-auth/commit/a33e204b5b14fd7e4ad46c94018cda6c9eda938f) refactor(stripe): rename metered to isMetered for consistency - [`0908702`](https://github.com/better-auth/better-auth/commit/09087026796666b444ab1a90ff65bbb31b94ebfb) fix(stripe): fall back to priceId when lookupKey resolves to nothing - [`c90ae3d`](https://github.com/better-auth/better-auth/commit/c90ae3d2a99593f575fce775edb1742967965636) Merge branch 'main' into 2026-04-03/fix/stripe-metered-quantity - [`5c85f4a`](https://github.com/better-auth/better-auth/commit/5c85f4a9d7c8c1934b58f222e10466d2ac94711f) chore: add changeset for PR #8926 ### 📊 Changes **5 files changed** (+657 additions, -25 deletions) <details> <summary>View changed files</summary> ➕ `.changeset/pr-8926.md` (+5 -0) 📝 `packages/stripe/src/routes.ts` (+59 -25) 📝 `packages/stripe/test/seat-based-billing.test.ts` (+6 -0) 📝 `packages/stripe/test/stripe-organization.test.ts` (+12 -0) 📝 `packages/stripe/test/stripe.test.ts` (+575 -0) </details> ### 📄 Description > [!NOTE] > Subscriptions have two kinds of usage-based billing: metered and per-seat licensing. You can enable these billing models by setting the value of the recurring[usage_type] attribute when creating a price. You can only specify a quantity when creating a subscription with a recurring[usage_type] of licensed. If you want to have granular billing for usage that fluctuates within a billing interval, consider using [usage-based billing](https://docs.stripe.com/products-prices/pricing-models#usage-based-pricing) instead of quantities. > > https://docs.stripe.com/billing/subscriptions/quantities#multiple-quantities-sub The current model doesn't support "metered-only" directly. It was possible via a workaround by setting the base price to free. This PR improves that. - Closes #8920 --- <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 22:45:47 -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#25202