Tax: estimates, documents, credits
Directions
| Direction | Meaning | AvaTax document type | GL bucket |
|---|---|---|---|
Receivable (AR) | PVC invoices a client and collects sales tax | SalesInvoice (estimate: SalesOrder) | SalesTaxPayable |
Payable (AP) | A vendor or subcontractor bills PVC. PVC accrues use tax when the vendor didn't charge it. | PurchaseInvoice (estimate: PurchaseOrder) | UseTaxAccrual |
Lines: labor, material, freight...
Taxability depends on the state and on what is being sold, so labor and materials are always separate lines.
Each line has a category (Labor, Material, Freight, Fee, Equipment, Other) plus the work type,
sub-type and trade. The tax-code mapping table turns those into an AvaTax tax code. A line can also
carry its own jobSite when it differs from the document's.
Lifecycle of a document
- Idempotency key:
entityId + sourceSystem + sourceDocumentId + direction. Resending identical content returns the same document (200). Different content replaces it (200,Updated) until it is committed. - Committed documents never change. A correction is a credit (
POST /tax/documents/{id}/credits) at the original tax date and exchange-rate lock, capped at what remains uncredited on each line.
Estimates
POST /api/v1/tax/estimates returns the total tax and per-line, per-jurisdiction detail. Nothing is recorded at
AvaTax. Use it before a PO or NTE is approved: a $250 job with $8 of tax needs a $258 NTE.
Addresses
POST /api/v1/addresses/validate standardizes a job site and geocodes it. Validate when a job site is created. A ZIP
code in Ohio can span several cities and counties, and the coordinates pin the right one.
Tax codes
The tax_code_mappings table maps (category, work type, sub-type, trade, country) to an AvaTax tax code, with
effective dates. The most specific active row wins, and a taxCode on the line overrides the table. Mappings are
data, so Phase 2 work types need no redeploy. Manage them with /api/v1/admin/tax-code-mappings.
Canada
GST, HST, PST and QST come back from the same AvaTax call. They apply only to entities with the canadaTax flag
and a Canadian registration configured in AvaTax.