Skip to main content
Taxation is driver-based, allowing custom tax calculation logic to replace or extend the default system.

Overview

Taxation is complex and sometimes what Lunar offers out of the box is not sufficient. This is why taxation is driver-based, allowing custom logic to be added as needed. By default, a SystemTaxDriver is used, which relies on Lunar’s internal models and database as outlined in the Taxation reference. To use a custom implementation, the driver can be changed in the config/lunar/taxes.php config file.

Writing a Custom Driver

A custom driver must implement the Lunar\Base\TaxDriver interface:
Once the driver is created, register it by extending the tax manager in a service provider:
Then set the driver in the config/lunar/taxes.php config: