Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Billing Core Laravel Package

emeroid/laravel-billing-core

Driver-based, multi-gateway billing for Laravel with a fluent API for one-time payments and subscriptions. Supports Paystack and PayPal, plan swapping, grace-period cancellation, dunning via webhooks, events, and a Billable trait for your User model.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Monolithic vs. Modular Fit: The package aligns well with Laravel’s modular ecosystem, offering a driver-based architecture that abstracts gateway-specific logic (Paystack, PayPal). This reduces coupling and allows for future gateway expansion.
  • SaaS-Specific Needs: Directly addresses core billing workflows (subscriptions, dunning, plan swaps) without forcing a full-stack solution (e.g., Stripe’s all-in-one). Ideal for SaaS apps needing customizable billing logic without vendor lock-in.
  • Event-Driven Design: Leverages Laravel’s event system (SubscriptionStarted, invoice.payment_failed) for extensibility, enabling hooks for analytics, notifications, or custom workflows.
  • Database Abstraction: Includes migrations for billing tables (e.g., subscriptions, invoices), but assumes Laravel’s Eloquent ORM. May require schema adjustments for non-standard DB setups.

Integration Feasibility

  • Laravel Compatibility: Built for Laravel 8+ (likely 9/10 based on modern syntax). Assumes:
    • Eloquent models (e.g., User with Billable trait).
    • Queue system (for async webhook processing).
    • File storage (for receipts/invoices).
  • Gateway-Specific Quirks: Paystack/PayPal drivers may need API key handling (e.g., .env variables) and webhook verification (e.g., PayPal’s IPN or Paystack’s hooks). Risk of misconfigured endpoints if not tested early.
  • Customization Overrides: Core logic (e.g., dunning, plan swaps) is extensible via service providers or events, but deep customization may require forking or extending base classes.

Technical Risk

  • Low-Maturity Warning: No stars/issues/commits suggest unproven reliability in production. Key risks:
    • Undocumented Edge Cases: Subscription swaps during trials, prorations, or concurrent payments may need manual handling.
    • Webhook Reliability: Dunning logic depends on invoice.payment_failed events; flaky webhooks could lead to stale past_due states.
    • Gateway-Specific Bugs: Paystack/PayPal drivers might not cover all edge cases (e.g., failed refunds, currency conversions).
  • Testing Gaps: Lack of tests implies manual validation for critical paths (e.g., plan swaps, dunning retries).
  • Migration Complexity: Publishing migrations could overwrite existing billing tables if not managed carefully.

Key Questions

  1. Gateway Support:
    • Does the app need additional gateways (e.g., Stripe, Flutterwave)? If so, is the driver architecture easy to extend?
    • Are there regional compliance requirements (e.g., PSD2 for EU, PCI for cards) that the package doesn’t address?
  2. Data Model:
    • How will billing data (subscriptions, invoices) integrate with existing analytics (e.g., Mixpanel, custom reports)?
    • Are there custom fields needed in the subscriptions table (e.g., trial_ends_at)?
  3. Failure Modes:
    • What’s the retry strategy for failed webhooks (e.g., exponential backoff)?
    • How are failed payments communicated to users (e.g., emails, in-app alerts)?
  4. Performance:
    • Will high-volume subscriptions (e.g., 10K+ users) stress the queue or database?
    • Are there rate limits on gateway APIs (e.g., PayPal’s 2000 calls/day) that need monitoring?
  5. Maintenance:
    • Who will update the package if bugs are found (e.g., PayPal API changes)?
    • Is there a rollback plan if the package breaks during a release?

Integration Approach

Stack Fit

  • Laravel Ecosystem: Seamless integration with:
    • Eloquent: Billable trait extends User model for subscription metadata.
    • Queues: Async processing of webhooks/events (e.g., SubscriptionCancelled).
    • Events: Extensible for notifications (e.g., Notification::send(new SubscriptionStarted($user))).
    • Mail: Built-in receipt/invoice generation (if using Laravel’s mail driver).
  • Gateway Dependencies:
    • Paystack/PayPal: Requires API keys, webhook endpoints, and SSL for production.
    • Additional Gateways: If needed, must implement GatewayDriver interface (abstract class provided).
  • Database:
    • Migrations create tables for subscriptions, invoices, and payments. Conflict risk if the app already has billing tables.
    • Assumes MySQL/PostgreSQL; no SQL Server support noted.

Migration Path

  1. Pilot Phase:
    • Start with one gateway (e.g., Paystack) in a staging environment.
    • Test core workflows: subscription creation, cancellation, plan swaps.
    • Validate webhook handling (e.g., simulate payment_failed events).
  2. Incremental Rollout:
    • Phase 1: One-time payments (simplest use case).
    • Phase 2: Subscriptions + dunning (highest complexity).
    • Phase 3: Plan swaps and prorations (edge cases).
  3. Data Migration:
    • If replacing an existing system, write a data mapper to convert old subscriptions/invoices to the new schema.
    • Example: php artisan billing:migrate-data (custom command).

Compatibility

  • Laravel Version: Tested on Laravel 8+; may need adjustments for Laravel 10 (e.g., dependency updates).
  • PHP Version: Requires PHP 8.0+ (check for match expressions, named arguments).
  • Gateway-Specific:
    • Paystack: Ensure API version compatibility (e.g., v2023-06-20).
    • PayPal: Verify webhook signatures and certificate validation.
  • Third-Party Conflicts:
    • Avoid naming collisions (e.g., Subscription model if the app already has one).
    • Check for package dependencies (e.g., guzzlehttp/guzzle for API calls).

Sequencing

  1. Setup:
    • Install package + publish config/migrations.
    • Configure .env with gateway credentials.
  2. Core Integration:
    • Add Billable trait to User model.
    • Set up webhook endpoints (e.g., /billing/webhooks/paypal).
  3. Testing:
    • Unit tests for Subscription logic (e.g., swapPlan).
    • Integration tests for webhooks (e.g., payment_failed).
  4. Monitoring:
    • Log webhook payloads for debugging.
    • Track past_due status transitions.
  5. Go-Live:
    • Enable dunning logic in production.
    • Monitor queue jobs for failures.

Operational Impact

Maintenance

  • Vendor Lock-In: MIT license allows forks, but abandonware risk exists (no maintainer).
  • Upgrade Path:
    • Composer updates may break if the package evolves rapidly.
    • Semver compliance assumed but untested (no release history).
  • Custom Logic:
    • Extensions (e.g., new gateways) require local code maintenance.
    • Events provide hooks, but complex logic may need monkey-patching base classes.

Support

  • Debugging:
    • Lack of community means trial-and-error for issues (e.g., dunning failures).
    • Logs must be detailed (e.g., gateway API responses, webhook payloads).
  • Gateway-Specific Issues:
    • Paystack/PayPal rate limits or API changes may break the package.
    • Webhook retries need monitoring (e.g., failed payment_succeeded events).
  • User Support:
    • Failed payments: Requires clear communication (e.g., "Your card was declined").
    • Plan swaps: May need manual intervention for complex cases (e.g., prorations).

Scaling

  • Database:
    • subscriptions table could grow large; consider archiving old records.
    • Indexes needed on user_id, status, ends_at for queries.
  • Queue:
    • Webhook processing must handle high throughput (e.g., 1000+ events/day).
    • Consider batch processing for dunning retries.
  • Gateways:
    • PayPal/Paystack have API limits; implement exponential backoff for retries.
    • Concurrent requests may hit rate limits (e.g., 100 subscriptions/sec).

Failure Modes

Failure Scenario Impact Mitigation
Webhook delivery fails Stale past_due status Implement retry queue with dead-lettering.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
hexters/coinpayment
rjcodes/rjcms
act-training/laravel-permissions-manager
alimarchal/laravel-chart-of-accounts
babenkoivan/elastic-scout-driver
mkwebdesign/filament-watchdog-v5
renatomarinho/laravel-page-speed
zedmagdy/filament-business-hours
renatovdemoura/blade-elements-ui
devgeek/beacon-admin
benjamin-rqt/data-watcher-bundle
atriumphp/atrium
sandermuller/package-boost-laravel
sandermuller/boost-skills
redaxo/core
yusufgenc/filament-api-forge
l3aro/rating-star-for-filament
leek/filament-subtenant-scope
anil/file-picker
broqit/fields-ai