Download the PHP package bhhaskin/laravel-billing without Composer
On this page you can find all versions of the php package bhhaskin/laravel-billing. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package laravel-billing
Laravel Billing
Stripe-based subscription and billing management for Laravel applications.
Features
Subscription Management
- Multiple Plans & Add-ons - Support for base plans and both standalone and plan-dependent add-ons
- Stripe Integration - Full Stripe integration with idempotent webhook handling
- Proration - Configurable proration for plan changes and cancellations
- Plan Changes - Immediate and scheduled plan changes with upgrade/downgrade detection
- Trial Periods - Optional trial periods per plan
- Grace Periods - Configurable grace periods for failed payments
- Discount Codes - Percentage and fixed discounts with flexible durations
- Payment Method Expiry - Configurable warning window with
PaymentMethodExpiringevent and scheduled command
Financial Operations
- Integer-Cents Money - All amounts stored and computed as integer minor units (no float precision bugs)
- Refund System - Full and partial refunds with automatic credit creation
- Customer Credits - Complete credit/debit tracking with running balances and expiration support
- Usage-Based Billing - Track and bill for metered usage
- Quota Tracking - Track usage against limits with automatic warnings and exceeded events
Developer Experience
- Workspace Support - Optional multi-tenancy with bhhaskin/laravel-workspaces
- Audit Trail - Optional audit logging with bhhaskin/laravel-audit
- Fully Tested - Comprehensive test suite with 100+ tests
- UUIDs - All models include UUIDs for secure API endpoints
Installation
Publish Configuration
Publish and Run Migrations
Configuration
Add your Stripe credentials to .env:
Money Handling
All monetary values are stored and exchanged as integer minor units (cents for USD, pence for GBP, etc.) — never as floats or decimals. This eliminates precision bugs and aligns with Stripe's API conventions.
For display, divide by 100 or use Number::currency($plan->price / 100, 'USD').
If you are upgrading from < 0.4.0, the migrate command converts existing decimal data automatically. See the CHANGELOG for the full upgrade guide.
Usage
Add Billable Trait to User Model
Create Plans
Subscribe Users
Check Subscriptions
Plan Changes
Change subscription plans immediately or schedule for later:
Customer Credits
Manage customer credit balances for refunds, promotions, and adjustments:
Refunds
Create full or partial refunds for paid invoices:
Quota Tracking
Track usage against plan limits and automatically fire events when quotas are reached:
Quota Events
The package fires events when quotas reach warning thresholds (default: 80%, 90%) or are exceeded:
Event properties:
$event->billable- The billable model (User)$event->quotaKey- The quota identifier (e.g., 'disk_space')$event->currentUsage- Current usage amount$event->limit- The quota limit from the plan$event->thresholdPercentage- Warning threshold (QuotaWarning only)$event->overage- Amount over limit (QuotaExceeded only)
Configure warning thresholds in config/billing.php:
API Routes
Include the API routes in your routes/api.php:
Stripe Webhooks
Wire the webhook endpoint to your application's routes file. Exclude it from CSRF verification:
In your application's StripeWebhookController (if you need custom handling), extend the package controller and override only the handler methods you need:
Webhook Idempotency
Every event delivered to the webhook endpoint is recorded in billing_webhook_events keyed by Stripe's event.id. Duplicate deliveries (Stripe retries, multi-endpoint setups, manual replays) are returned 200 immediately without re-running handlers. Each handler runs inside a database transaction; failures leave processed_at null so a subsequent re-delivery will retry.
Configure retention in config/billing.php (default 90 days), and prune old records:
The package also auto-schedules this weekly when auto_register_scheduler is enabled.
Payment Method Expiry Warnings
The billing:check-expiring-payment-methods command iterates active card payment methods and dispatches a PaymentMethodExpiring event for any card within the configured warning window (default 60 days, set via billing.payment_method_expiry.warning_days).
Each card fires the event exactly once per (card, expiry-month) combination — debounced via metadata so daily scheduling does not flood your notifications.
Listen for the event in your application:
Daily Billing Processing
The package automatically schedules a daily billing command to process renewals, trial expirations, and grace periods. You can disable this in config and run it manually:
Testing
License
This package is open-sourced software licensed under the MIT license.
All versions of laravel-billing with dependencies
illuminate/auth Version ^10.0 || ^11.0
illuminate/database Version ^10.0 || ^11.0
illuminate/support Version ^10.0 || ^11.0
illuminate/console Version ^10.0 || ^11.0
stripe/stripe-php Version ^13.0