[PR #7946] [MERGED] fix(stripe): move meters config into plans for usage-based billing #33245

Closed
opened 2026-04-17 23:53:46 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/better-auth/better-auth/pull/7946
Author: @bytaesu
Created: 2/12/2026
Status: Merged
Merged: 2/12/2026
Merged by: @bytaesu

Base: canaryHead: 2026-02-13/fix/stripe-meter


📝 Commits (4)

  • 9114ef3 fix(stripe): move meters config into plans for usage-based billing
  • a5ec79e fix: merge endpoints
  • bd559d5 chore: grammer
  • d7211bf test: add cases for checkout with usage-based meters

📊 Changes

8 files changed (+192 additions, -67 deletions)

View changed files

📝 packages/stripe/src/client.ts (+2 -4)
📝 packages/stripe/src/index.ts (+0 -14)
📝 packages/stripe/src/routes.ts (+9 -4)
📝 packages/stripe/src/types.ts (+9 -30)
📝 packages/stripe/src/utils.ts (+5 -4)
📝 packages/stripe/test/metered-billing.test.ts (+9 -4)
📝 packages/stripe/test/seat-based-billing.test.ts (+144 -0)
📝 packages/stripe/test/utils.test.ts (+14 -7)

📄 Description

Summary by cubic

Moved usage-based meter config into each plan and auto-added their usage prices during checkout and upgrades. Usage endpoints now work whenever subscriptions are enabled, and events validate against meters on any plan.

  • New Features

    • Plans can define meters: { eventName, priceId }.
    • Checkout/upgrade auto-adds meter price items from the selected plan.
    • Usage ingest/query endpoints are available when subscriptions are enabled; validation checks meters across all plans.
  • Migration

    • Move subscription.meters to subscription.plans[].meters (add priceId for each).
    • Replace MeterConfig with the plan-level meters type and ensure each priceId targets a usage-based price linked to the Stripe Billing Meter.

Written for commit d7211bfc94. Summary will update on new commits.


🔄 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/7946 **Author:** [@bytaesu](https://github.com/bytaesu) **Created:** 2/12/2026 **Status:** ✅ Merged **Merged:** 2/12/2026 **Merged by:** [@bytaesu](https://github.com/bytaesu) **Base:** `canary` ← **Head:** `2026-02-13/fix/stripe-meter` --- ### 📝 Commits (4) - [`9114ef3`](https://github.com/better-auth/better-auth/commit/9114ef32e7f1c8b15502bb174e4050ff01123f82) fix(stripe): move meters config into plans for usage-based billing - [`a5ec79e`](https://github.com/better-auth/better-auth/commit/a5ec79ea99890b0d99f4423c12a044f0ad7aec03) fix: merge endpoints - [`bd559d5`](https://github.com/better-auth/better-auth/commit/bd559d5fd785f214ad5ae2d2cec2f94f396257c1) chore: grammer - [`d7211bf`](https://github.com/better-auth/better-auth/commit/d7211bfc9499094152cbc16625121382920cb07b) test: add cases for checkout with usage-based meters ### 📊 Changes **8 files changed** (+192 additions, -67 deletions) <details> <summary>View changed files</summary> 📝 `packages/stripe/src/client.ts` (+2 -4) 📝 `packages/stripe/src/index.ts` (+0 -14) 📝 `packages/stripe/src/routes.ts` (+9 -4) 📝 `packages/stripe/src/types.ts` (+9 -30) 📝 `packages/stripe/src/utils.ts` (+5 -4) 📝 `packages/stripe/test/metered-billing.test.ts` (+9 -4) 📝 `packages/stripe/test/seat-based-billing.test.ts` (+144 -0) 📝 `packages/stripe/test/utils.test.ts` (+14 -7) </details> ### 📄 Description <!-- This is an auto-generated description by cubic. --> ## Summary by cubic Moved usage-based meter config into each plan and auto-added their usage prices during checkout and upgrades. Usage endpoints now work whenever subscriptions are enabled, and events validate against meters on any plan. - **New Features** - Plans can define meters: { eventName, priceId }. - Checkout/upgrade auto-adds meter price items from the selected plan. - Usage ingest/query endpoints are available when subscriptions are enabled; validation checks meters across all plans. - **Migration** - Move subscription.meters to subscription.plans[].meters (add priceId for each). - Replace MeterConfig with the plan-level meters type and ensure each priceId targets a usage-based price linked to the Stripe Billing Meter. <sup>Written for commit d7211bfc9499094152cbc16625121382920cb07b. Summary will update on new commits.</sup> <!-- 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-04-17 23:53:46 -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#33245