In Part 3, we established secure multi-tenant identity and tenant-scoped role authorization. In Part 4 of our enterprise guide, we integrate the engine that transforms code into sustainable business revenue: subscription billing, tier entitlements, metered usage tracking, and automated payment synchronization using Laravel Cashier in Laravel 13.
Engineering billing logic for multi-tenant software is fraught with business risk. Handling credit card updates, prorated plan upgrades, localized taxes, grace periods for failed payments, and usage-based quotas requires seamless synchronization between your application state and external payment gateways like Stripe.
1. Integrating Laravel Cashier into the Tenant Model
In single-user applications, Cashier’s Billable trait is conventionally attached to the User model. However, in B2B SaaS architecture, billing ownership belongs strictly to the corporate organization: the Tenant model must be the billable entity. The customer who enters their corporate credit card is paying for their workspace, team members, and resource allocations.
Attaching Billable to our Tenant model allows Cashier to manage Stripe customer tokens, payment methods, and active subscriptions directly against the tenant’s record. This architectural clarity ensures that if team personnel depart or ownership transfers, corporate subscription continuity remains entirely uninterrupted.

2. Tiered Pricing, Feature Flags, and Middleware Entitlements
Most SaaS applications monetize across structured tiers—such as Starter, Professional, and Enterprise. As an architect, you must translate these commercial packages into programmatic feature entitlements and resource constraints.
In Laravel 13, we enforce feature access using custom route middleware (e.g., subscribed:feature-name) combined with model policy checks. If a tenant on the Starter plan attempts to access advanced analytics or audit export features reserved for Enterprise tiers, middleware intercepts the request and returns an informative HTTP 402 Payment Required or prompts an in-app upgrade modal.
3. Metered Usage Tracking and Real-Time Billing Reporting
Modern cloud software increasingly adopts consumption-based or hybrid billing models where tenants are charged based on quantifiable resource usage—such as API calls executed, gigabytes of storage consumed, or active team seats occupied. Laravel Cashier seamlessly connects to Stripe’s metered billing engine.
Whenever a tenant executes billable units, our background workers dispatch usage records using Cashier’s reporting methods: $tenant->subscription()->reportUsageFor('metered-feature-id', $units). By offloading usage reporting to asynchronous queues, we ensure that tracking billable events never adds latency to user-facing API responses or dashboard interactions.

4. Resilient Webhook Processing and the Stripe Customer Portal
Never rely solely on immediate HTTP redirects after a checkout session to confirm payment success. Network interruptions, browser crashes, or fraud reviews can prevent checkout callbacks from firing. The single source of truth for payment lifecycle events is Stripe Webhooks.
Laravel Cashier ships with pre-configured webhook controllers that handle essential events such as invoice.payment_succeeded, invoice.payment_failed, and customer.subscription.deleted. Furthermore, integrating the Stripe Customer Portal allows tenants to self-serve their billing needs—updating credit cards, downloading PDF tax invoices, and switching subscription intervals—without requiring custom frontend payment forms or PCI-compliance liability.
What Lies Ahead in Part 5
With revenue collection automated and tenant subscriptions active, high platform traffic demands industrial-strength backend processing. In Part 5: Background Queues, Asynchronous Jobs & Rate Limiting, we will implement Redis-backed queues, Laravel Horizon telemetry, tenant job isolation to prevent noisy neighbors, and dynamic rate limiters.
