BillaBear is an open-source, self-hostable billing and subscription management platform designed for SaaS businesses that need full control over their billing infrastructure. It solves the complexity of managing recurring payments, tax compliance, and customer billing workflows without relying on proprietary SaaS billing tools. Built in PHP and powered by Stripe, it provides a REST API for seamless integration into existing systems while supporting multi-currency, multi-language, and multi-brand setups.
The system is architected around extensible components: Twig templates for documents and emails, a workflow engine for async operations like refunds or onboarding, and integrations with tax services like VAT Sense and accounting tools like Xero. It can be deployed on any server with PHP and MySQL, and offers both open-source and managed cloud versions with different update cycles.
What You Get
- Tax System - Configurable country and state tax rules with EU reverse charge, one-stop-shop (OSS), and threshold-based tax triggers; integrates with VAT Sense for automated EU tax rule sync.
- Workflow System - Async, retryable workflows for critical billing operations like refunds, subscription creation, or onboarding tasks to eliminate manual intervention.
- Invoice & Document Generation - PDF invoices, quotes, and receipts generated via Twig templates, allowing non-technical teams to customize branding and content.
- Multiple Pricing Models - Supports fixed pricing, tiered volume, stair pricing, package-based billing, seat-based pricing, and usage-based billing with monthly usage tracking.
- Email Template Management - Use either EMSP templates (SendGrid, Mailgun, PostMark) or Twig templates to customize transactional emails without code changes.
- Hosted Checkout & Paylinks - Generate Stripe.JS tokens to embed secure, branded checkout pages or one-time paylinks directly into your app or website.
- Dunning & Credit Notes - Automated retry logic for failed payments and support for issuing credit notes to customers with customizable rules.
- Multi-Currency & Multi-Language - Full support for billing in multiple currencies and displaying content in multiple languages based on customer locale.
- Webhooks & Integrations - Built-in webhooks and integrations with Slack, Xero, EasyBill, Mailchimp, FreshDesk, Zendesk, and DocRaptor for PDF generation.
Common Use Cases
- Running a SaaS with EU tax compliance - A European SaaS company uses BillaBear to automatically apply VAT rules, handle OSS reporting, and trigger tax thresholds based on customer location and revenue.
- Managing usage-based billing for developers - A developer platform bills customers based on monthly API calls or compute usage, using BillaBear’s package and tiered pricing models to track and invoice consumption.
- Customizing invoices for enterprise clients - An enterprise software vendor uses Twig templates to brand invoices with client logos, custom terms, and legal disclaimers without involving engineering.
- Automating refund workflows after failed payments - A subscription service uses BillaBear’s workflow engine to automatically retry failed refunds and notify support teams if retries fail, reducing manual ticket volume.
Under The Hood
Architecture
- Symfony-based monolithic architecture leveraging MicroKernelTrait and PSR-4 autoloading to enforce clear separation of concerns across domain layers including DTOs, entities, repositories, and data mappers
- Domain-driven design principles are deeply embedded, with explicit data mappers decoupling external payloads from internal entities, enhancing testability and business logic clarity
- Dependency injection via constructor injection ensures loose coupling, while event-driven notifications abstract delivery mechanisms through typed event classes and abstract base classes
- Doctrine ORM is enhanced with custom repositories and Symfony Validator annotations, enabling robust business rule enforcement at the model layer alongside a cohesive Vue 3 frontend powered by Pinia and Vue Router
Tech Stack
- PHP 8.3+ backend built on Symfony 7.2 with Doctrine, Messenger for async workflows, and Scheduler for automated tasks
- PostgreSQL with TimescaleDB for time-series billing data, complemented by Redis for caching and session management
- Vue 3 frontend utilizing the composition API, Pinia for state management, and Vite/Webpack Encore for asset pipeline, paired with Tailwind CSS, Flowbite-Vue, and HeadlessUI for UI components
- Full-stack Dockerized environment with nginx, php-fpm, Elasticsearch, and mail servers ensuring consistent development and deployment
Code Quality
- Extensive test coverage across unit, integration, and behavioral tests with PHPUnit, Vitest, and Behat, ensuring reliability across complex billing workflows
- Strong type safety enforced through PHP 8.1+ features including typed properties, union types, and immutable DTOs, reducing runtime errors and improving maintainability
- Consistent, business-terminology-driven naming conventions and structured API responses enhance readability and reduce cognitive load
- Comprehensive mocking and stubbing in frontend tests validate both success and failure paths with precision, though custom exception classes are underutilized
What Makes It Unique
- Native SFTP and webhook-based invoice delivery eliminates dependency on third-party document services, offering full control over document generation and distribution
- Workflow-driven subscription lifecycle management enables state-aware, extensible processing of complex billing events
- Built-in daily analytics entities automatically aggregate key metrics at the database level without external tools
- PayLinkGeneratorInterface provides a pluggable contract for payment gateways, ensuring API consistency while supporting diverse payment providers
- Fair Core License introduces ethical usage constraints, distinguishing it from conventional open-source models by promoting responsible adoption