Skip to main content

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.

Zuny FesterBy Zuny Fester, Head of Operations and Marketing
Reviewed by Zuny Fester
Published Last reviewed Editorial policy

Part of the finance integrations guide.

Document types supportedSalesInvoice, SalesOrder only, per Loopfour's integration schema
Required fieldsdocumentType, customerCode, a unique document code, and line items
What Avalara returnstotalTax (calculated tax) and grandTotal (totalAmount + totalTax)
Not exposed hereAvaTax'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.

Book a workflow review

Field mapping

Fields Loopfour sends to and receives from AvaTax for an AR invoice

FieldDirectionPurpose
documentTypeSentSalesInvoice or SalesOrder — the only two values Loopfour's schema accepts
codeSentUnique document code — reused against a committed transaction fails with DocumentCodeConflict
customerCodeSentIdentifies the buyer for tax jurisdiction and exemption purposes
totalTaxReturnedCalculated tax, separate from the pre-tax amount
grandTotalReturnedtotalAmount + totalTax — what the customer should actually be charged

Frequently Asked Questions

Not currently — Loopfour's integration schema restricts documentType to SalesInvoice and SalesOrder, even though AvaTax's own API supports PurchaseInvoice and PurchaseOrder for the buy side.

If the original transaction was already committed, AvaTax returns a DocumentCodeConflict error rather than overwriting it. If it was never committed, sending the same code again updates that transaction instead of creating a new one.

No — an uncommitted transaction still returns a real totalTax figure you can charge against, but it won't count toward tax-liability reporting until it's explicitly committed.

Sources

Related