Skip to content

fix(enterprise-billing): simplification to be fixed-cost #1196

Merged
waleedlatif1 merged 9 commits intostagingfrom
fix/enterprise-billing
Aug 31, 2025
Merged

fix(enterprise-billing): simplification to be fixed-cost #1196
waleedlatif1 merged 9 commits intostagingfrom
fix/enterprise-billing

Conversation

@icecrasher321
Copy link
Collaborator

Summary

Simplification to just auto-generate invoice with fixed cost of their respective configured product and standardized updating of period end and period start.

Type of Change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation
  • Other: ___________

Testing

IN PROGRESS

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Aug 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
sim Ready Ready Preview Comment Aug 31, 2025 0:22am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
docs Skipped Skipped Aug 31, 2025 0:22am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR implements a significant architectural change to enterprise billing, transitioning from a complex usage-based, per-seat pricing model to a simplified fixed-cost subscription model. The changes affect multiple layers of the billing system:

Core Billing Logic Changes:

  • The EnterpriseSubscriptionMetadata interface is simplified to only include monthlyPrice instead of complex seat-based pricing fields (perSeatPrice, maxSeats, fixedSeats)
  • The getPlanPricing function is simplified to only accept a plan string parameter, removing subscription-specific calculations
  • Enterprise plans now return a basePrice of 0 for overage calculations, effectively eliminating usage-based billing

Organization Management:

  • Enterprise organizations now have their usage limits automatically set to match their monthly price during subscription setup
  • Enterprise plans can no longer edit their usage limits through the UI or API
  • Seat management for enterprise plans becomes fixed (no self-service changes)

Invoice and Billing Processing:

  • Enterprise plans are excluded from overage invoice generation entirely
  • Usage resets still occur at cycle end for proper accounting, but no additional charges are calculated
  • The billing system now treats enterprise subscriptions as predictable fixed-cost arrangements

Authentication and Validation:

  • Enhanced validation ensures enterprise subscriptions include valid referenceId and monthlyPrice metadata
  • Automatic organization limit updates maintain consistency between billing configuration and usage controls

This refactoring integrates with the existing subscription management system by maintaining the same database schema while changing how enterprise billing calculations are performed. The changes preserve existing functionality for Pro and Team plans while creating a separate, simplified path for Enterprise customers.

Confidence score: 2/5

  • This PR introduces breaking changes to enterprise billing with potential for billing calculation errors
  • Score reflects significant architectural changes across critical billing components without complete testing
  • Pay close attention to billing calculation files, enterprise subscription handling, and overage logic

11 files reviewed, 7 comments

Edit Code Review Bot Settings | Greptile

@vercel vercel bot temporarily deployed to Preview – docs August 31, 2025 00:17 Inactive
@waleedlatif1 waleedlatif1 merged commit 7780d9b into staging Aug 31, 2025
5 checks passed
@waleedlatif1 waleedlatif1 deleted the fix/enterprise-billing branch August 31, 2025 00:26
waleedlatif1 added a commit that referenced this pull request Sep 1, 2025
* fix(enterprise-billing): simplify

* conceptual improvement

* add seats to enterprise sub meta

* correct type

* fix UI

* send emails to new enterprise users

* fix fallback

* fix merge conflict issue

---------

Co-authored-by: waleedlatif1 <walif6@gmail.com>
arenadeveloper02 pushed a commit to arenadeveloper02/p2-sim that referenced this pull request Sep 19, 2025
…#1196)

* fix(enterprise-billing): simplify

* conceptual improvement

* add seats to enterprise sub meta

* correct type

* fix UI

* send emails to new enterprise users

* fix fallback

* fix merge conflict issue

---------

Co-authored-by: waleedlatif1 <walif6@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants