Deprixa Plus — SaaS Billing Module · 8.6 Plan Limits Enforcement
The SaasUsageService validates resource consumption before each operation. When a limit is reached, the operation is blocked with a clear error message showing current usage versus the plan limit.
How Limits Are Checked
| Resource | How It Is Measured |
|---|---|
| Shipments | Count of shipments created this billing cycle vs max_shipments |
| Users | Count of active users in the organization vs max_users |
| Branches | Count of branches in the organization vs max_branches |
| Storage | Scan of the organization's directory size vs storage_gb |
| API Calls | Daily counter vs api_calls_daily |
Limit Reached Behavior
When a limit is reached, the operation is blocked and the user sees an error message such as: "Shipment limit reached: 500 / 500. Upgrade your plan to continue."
Subscription Status Middleware
The CheckSubscriptionStatus middleware enforces access control based on subscription state. Organizations in read_only or suspended status have all write operations (POST, PUT, PATCH, DELETE) blocked at the middleware level, regardless of individual resource limits.
SCREENSHOT — Limit reached error message shown when creating a shipment