Tax Line
First-Pass Node Dossier
This page is an evidence-backed node dossier generated from the domain hierarchy and node questionnaire.
What It Is
TaxLine is the derived tax-breakdown record that stores the calculated tax amount for a taxable model such as an order item, shipping line, discount line, invoice line, or return line.
Parent hierarchy:
Tax & TerritoryTax Calculations And Tax OutputTax Line
Primary implementation paths:
packages/framework/src/Models/TaxLine.phppackages/framework/src/Models/Traits/Taxable.phppackages/framework/src/Http/Controllers/Api/Admin/TaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderTaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderReturnTaxLinesController.php
What Users Can Do With It
Direct capabilities
Operators can:
- inspect tax-line rows attached to orders and returns through admin API resources
- view the calculated amount in a presentable money format
- use the tax-line output as part of order review and refund review workflows
Indirect capabilities
Other workflows use TaxLine to:
- drive invoice, fulfillment, and return tax totals
- feed Stripe checkout tax-rate mapping
- export tax data into the ERP bridge
Things users cannot do directly
The shared package does not expose TaxLine as a manually edited packaged record. It is recalculated from taxable sources.
Where It Is Managed
| Channel | Role | Notes |
|---|---|---|
| Admin order tax-lines API | Direct read-only | Lists tax lines for an order |
| Admin order-return tax-lines API | Direct read-only | Lists tax lines for a return |
| Storefront order tax-lines API | Direct read-only | Authenticated customer can inspect their order tax lines |
| Tax calculation trait | Indirect upstream input | Creates, updates, and deletes derived tax lines |
Sources:
packages/framework/src/Http/Controllers/Api/Admin/TaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderTaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderReturnTaxLinesController.phppackages/framework/src/Http/Controllers/Api/Storefront/OrderTaxLinesController.php
Creation Model
TaxLine is created and maintained by tax-calculation code, not by a direct packaged create form.
The triggering path is:
- a taxable model asks for tax rates
Taxable::calculateTaxesFromModel()builds derived tax-line objectsTaxable::saveTaxLines()updates existing rows, inserts new ones, and deletes stale rows
This same pattern is used by order, invoice, shipping, discount, return, and fulfillment-related tax calculations.
Sources:
packages/framework/src/Models/Traits/Taxable.phppackages/framework/src/Actions/Order/CalculateTaxes.phppackages/framework/src/Actions/OrderItem/CalculateTaxes.phppackages/framework/src/Actions/OrderShippingLine/CalculateTaxes.phppackages/framework/src/Actions/Invoice/CalculateTaxes.phppackages/framework/src/Actions/OrderReturn/CalculateTaxes.php
Configuration And Data Model
Key model characteristics:
- soft-deletable
- morphs to any taxable parent through
taxable() - belongs to
TaxRate - maps to the ERP bridge DTO
Important fields:
taxable_idtaxable_typetax_rate_idtitledescriptionjurisdictionpercentageamounttaxable_amountrateregistration_numbercurrency
Useful accessors:
amount_decimalamount_presentable
Source:
packages/framework/src/Models/TaxLine.php
Relationships
TaxLine directly connects to:
- the taxable parent record
- the tax rate that produced the calculation
- ERP bridge tax-line export payloads
Practical owners:
- orders
- order items
- shipping lines
- discount lines
- invoice lines
- return lines
Rules And Downstream Effects
Inclusive versus exclusive math
The tax calculation trait applies inclusive rates to the running total and exclusive rates to the subtotal. That means the order of tax rates can affect the computed amount.
Stale-line cleanup
When recalculated tax lines no longer match the current tax-rate set, stale rows are force-deleted.
Provider-driven null cases
If the provider cannot determine tax rates for a taxable object, no tax lines are generated.
Parent-tax regrouping
Order, return, and invoice tax totals are rebuilt by deleting existing parent tax lines, regrouping child tax lines by tax_rate_id, and recreating aggregate parent lines from that grouped output.
Sources:
packages/framework/src/Models/Traits/Taxable.phppackages/framework/src/Actions/TaxRate/Provider/Database/GetOrderTaxRates.phppackages/framework/src/Actions/TaxRate/Provider/TaxJar/GetOrderTaxRates.phppackages/framework/src/Actions/Order/CalculateTaxes.phppackages/framework/src/Actions/OrderReturn/CalculateTaxes.phppackages/framework/src/Actions/Invoice/CalculateTaxes.php
Integrations And Automation
ERP bridge export
TaxLine implements the bridge contract and converts itself into an ERP DTO.
Sources:
packages/framework/src/Models/TaxLine.phppackages/framework/src/Actions/ErpBridge/TaxLine/ToDTO.php
Checkout and tax-provider flows
Tax lines are consumed downstream by Stripe checkout mapping and by provider-backed tax calculations.
Sources:
packages/framework/src/Actions/Stripe/CreateStripeCheckout.phppackages/framework/src/Actions/TaxRate/Provider/TaxJar/GetOrderTaxRates.php
Where It Appears To End Users
TaxLine is mostly invisible as a standalone concept.
It appears as a breakdown inside order, invoice, shipping, and return details. Operators read it; they do not author it directly.
Current Documentation Takeaways
TaxLineis calculated output, not a manually managed tax setting.- The same record powers order, invoice, and return tax visibility, while parent totals are rebuilt from grouped child tax lines.
- ERP export is the main technical integration surface beyond admin and storefront read-only inspection.
Open Questions
- This pass did not find a packaged create/update UI for tax lines, which is consistent with the derived model behavior.
Sources:
packages/framework/src/Models/TaxLine.phppackages/framework/src/Models/Traits/Taxable.phppackages/framework/src/Http/Controllers/Api/Admin/TaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderTaxLinesController.phppackages/framework/src/Http/Controllers/Api/Admin/OrderReturnTaxLinesController.phppackages/framework/database/migrations/2022_11_26_132353_create_tax_lines_table.phppackages/framework/database/migrations/2026_01_02_000000_add_taxable_amount_to_tax_lines_table.phppackages/framework/src/Http/Controllers/Api/Storefront/OrderTaxLinesController.phppackages/framework/src/Actions/ErpBridge/TaxLine/ToDTO.php