Skip to documentation content

Developer Reference

Register a tax provider

Extend the Tax Rule Provider contract without changing calculation order, rounding, inclusive pricing or immutable booking snapshots.

Free exposes HB\Contracts\TaxRuleProviderInterface through the Tax Rule Provider Registry. Register a provider at the documented readiness action and keep its version within the active contract major. A provider can contribute validated rules, but it cannot bypass server pricing, inventory or snapshot authority. The readiness action is hb_tax_engine_ready; register only after that signal and keep the callback idempotent.

Preserve calculation semantics

  • The order is room subtotal, room discount, services subtotal, exclusive taxes and grand total. Coupons apply to the room subtotal only.
  • Percentage taxes use the inclusive or exclusive formula selected by the site. Fixed-price rules are exclusive-only where the contract says so.
  • Round each tax line to two decimal places before aggregation; never round only the final grand total.
  • Validate scope, dates, guest counts, nights, room IDs and rule priority on the server. Free’s single basic rule and Pro’s advanced multiple-rule boundary remain distinct.
  • Write the applied rule, amount, label, rate and inclusive/exclusive meaning into the booking snapshot. Historical reads never query live rules. Persist the canonical room_subtotal field inside an immutable snapshot so later reads do not depend on current provider output.

Do not register a provider that stores credentials in theme options or returns locale-formatted machine values. Coordinate any contract change as a separate Free/Pro regression phase.

Next: handle external inventory blocks.

Was this article helpful?

Your feedback helps us improve the documentation.