How do I connect Avalara to calculate tax on AR invoices?
Loopfour's Avalara integration creates AvaTax transactions scoped to sales-side document types — SalesInvoice or SalesOrder — each requiring a unique document code and a customerCode identifying the buyer. Avalara calculates tax against the line items you send and returns totalTax and grandTotal, which downstream steps use to invoice or charge the customer.
Part of the finance integrations guide.
| Document types supported | SalesInvoice, SalesOrder only, per Loopfour's integration schema |
|---|---|
| Required fields | documentType, customerCode, a unique document code, and line items |
| What Avalara returns | totalTax (calculated tax) and grandTotal (totalAmount + totalTax) |
| Not exposed here | AvaTax's own API also supports PurchaseInvoice/PurchaseOrder — Loopfour's schema doesn't currently use them |
What Loopfour's Avalara integration actually creates
Every AR-side tax calculation through Loopfour's Avalara integration goes through the same underlying call: creating an AvaTax transaction with documentType set to SalesInvoice or SalesOrder. Avalara's full API supports a much longer list of document types — sales, purchase, return, inventory-transfer, reverse-charge, and customs variants — but Loopfour's integration schema (avalaraDocumentTypeSchema) only accepts the two sales-side values. That's a scoping decision in Loopfour's code, not a limit of AvaTax itself.
Setting it up
Each transaction needs a document code that's unique within its company and document type — reused codes against a committed transaction return a DocumentCodeConflict error rather than creating a new record. It also needs a customerCode identifying the buyer, and at least one line item describing what's being sold, since tax is calculated per line based on the product/service and the ship-to address.
What you get back
A successful call returns totalTax (the calculated tax amount) separately from totalAmount (the pre-tax line total), plus grandTotal, which is the two added together — the number that should match what the customer is actually invoiced or charged. By default the transaction is created but not committed; committing it is what makes it count toward tax-liability reporting.
Next step
Map the finance workflow with the most exposure and prove the automation path.
Bring the invoice, contract, payment reconciliation, or customer finance workflow you have to defend at audit. Loopfour can map the trigger, controls, integrations, and approval loop.
Field mapping
Fields Loopfour sends to and receives from AvaTax for an AR invoice
| Field | Direction | Purpose |
|---|---|---|
| documentType | Sent | SalesInvoice or SalesOrder — the only two values Loopfour's schema accepts |
| code | Sent | Unique document code — reused against a committed transaction fails with DocumentCodeConflict |
| customerCode | Sent | Identifies the buyer for tax jurisdiction and exemption purposes |
| totalTax | Returned | Calculated tax, separate from the pre-tax amount |
| grandTotal | Returned | totalAmount + totalTax — what the customer should actually be charged |
Frequently Asked Questions
Sources
Related
Topic
AR & Collections
Accounts receivable is the money customers owe a business for goods or services already delivered on credit — a current asset on the balance sheet until it's collected. AR and collections, as a practi…
Read moreTopic
Integrations
Every finance automation vendor publishes an integrations page: a grid of logos, a claim of "seamless" connectivity, and not much else. That page answers a marketing question — does this vendor touch…
Read moreDiagnostic
Why is Avalara rejecting a sales invoice with a DocumentCodeConflict error?
A DocumentCodeConflict means the document code you sent already belongs to a committed transaction in AvaTax. The fix is not a fresh code — retrying with a new code every time is exactly what creates duplicate tax transactions on a real network retry. Keep the code stable, derived from the source invoice, and call the adjust or void endpoint if the original genuinely needs to change.
Read moreDiagnostic
Why doesn't an uncommitted Avalara transaction show up on my sales tax return?
AvaTax only reports committed transactions. Commit status is a flag that determines whether a transaction appears on your compliance reports and gets remitted — uncommitted transactions are treated as provisional and are excluded from liability calculations and filings until someone explicitly commits them.
Read more