Loopfour
Integrations

Avalara actions

Reference for the Avalara actions: the connection type, each action and what it does, its inputs and outputs, and the live catalog call.

The Avalara block calculates sales tax with AvaTax, reads a tax document back, and voids one a re-bill replaced. For the plain-language overview, see Avalara.

When to use it

Put an Avalara step before the step that charges or invoices the customer, so the charged amount includes tax. Use getTransaction to reuse a document an earlier attempt already created, and voidTransaction when an invoice is replaced.

Connection

ItemValue
Block typeavalara
ConnectionAPI key. In Integrations, Avalara asks for Account ID, License Key, Environment (Production or Sandbox) and an optional Company Code used as the step default
Account pinconfig.connection. An unpinned step uses the default Avalara connection; a pinned connection that no longer resolves stops the run instead of falling back, because the default may be a different environment

Actions

The action id is avalara.<action>. All three are in the Studio Action list.

ActionWhat it doesRequired config
createTransactionCreate an AvaTax transaction and return document and line taxdocumentCode, documentDate, customerCode, shipFrom, shipTo, lines
getTransactionRead a transaction by company, document code and typedocumentCode
voidTransactionVoid a transactiondocumentCode

Fields

FieldTypeUsed byMeaning
companyCodestringAllAvaTax company code. Defaults to the code stored on the connection
documentCodestringAllStable document code, for example the invoice number
documentTypeSalesInvoice (default), SalesOrder, ReturnInvoiceAllSalesOrder calculates only; ReturnInvoice is a credit with negative amounts
documentDateYYYY-MM-DDCreateRequired. AvaTax picks the rates and filing period from it
customerCodestringCreateAvaTax customer code
currencyCodestringCreateISO 4217 code. Omitted means USD; a blank or malformed value fails the step
shipFrom, shipToJSONCreate{ line1, city, region, postalCode, country }
linesJSON arrayCreate[{ number, amount, quantity?, itemCode?, taxCode?, description?, discounted?, exemptionCode? }]
referenceCodestringCreateOn a ReturnInvoice, the code of the invoice it credits
exemptionNostringCreateExemption certificate number
entityUseCodestringCreateAvaTax entity use code
taxOverrideJSONCreate{ type: "TaxAmount", taxAmount, reason } to file a tax amount decided elsewhere. taxAmount is in currency units with at most two decimals
discountnumberCreateReserved. A non-zero discount fails the step
commitbooleanCreateFinalize the document for filing. Default false
voidReasonCodeDocVoided (default), DocDeleted, PostFailed, AdjustmentCancelled, UnspecifiedVoidAvaTax reason code

Output

createTransaction returns transactionId, code, status, documentType, taxDate, currencyCode, totalAmount, totalTax, totalTaxCalculated, grandTotal, lineCount, linesTruncated, lines (up to 500, each with up to 32 jurisdiction details), summaryCount, summaryTruncated, summary (up to 100 rows) and messages.

  • grandTotal is in currency units (270.63 means $270.63). To charge it through a payment step that takes cents, write {{steps.<id>.grandTotal | multiply: 100}}.
  • Numeric line fields are null when AvaTax omits them, never 0. The step fails if AvaTax omits totalTax.

getTransaction returns { found: false, code, documentType } when there is no document, or found: true with transactionId, code, status, documentType, customerCode, totalAmount, totalTax, date, exemptionNo and lines.

voidTransaction returns transactionId, code, status and documentType as AvaTax confirmed them.

Replays and retries

  • Before creating, Loopfour asks AvaTax whether a document with the same company, type and code exists. If one does, the step fails with "Nothing was submitted". Matching creates are also serialized across workers.
  • Keep documentCode stable for one invoice. Reusing the same code is what lets this check stop a duplicate; a new code for each attempt defeats it.
  • If a create fails after it was sent (for example a rate limit), the step does not retry, because AvaTax may have stored the document. Check the document in Avalara, or call getTransaction, before you re-run.
  • Keep the step's error handling on fail. With continue, a later payment step could run with no tax amount.
  • When a re-bill replaces an invoice, void the old document with the same company code, document code and document type the create step used. Otherwise the old committed document stays in your filing.

Example

{
  "id": "calc_tax",
  "type": "action",
  "name": "Calculate sales tax",
  "action": "avalara.createTransaction",
  "config": {
    "operation": "createTransaction",
    "connection": "<avalara-connection-id>",
    "documentCode": "{{input.invoiceNumber}}",
    "documentType": "SalesInvoice",
    "documentDate": "2026-11-12",
    "customerCode": "{{input.customerId}}",
    "currencyCode": "USD",
    "shipFrom": { "line1": "1 Market St", "city": "Philadelphia", "region": "PA", "postalCode": "19103", "country": "US" },
    "shipTo": { "line1": "100 Main St", "city": "Seattle", "region": "WA", "postalCode": "98104", "country": "US" },
    "lines": [{ "number": "1", "amount": 250.0, "quantity": 2, "itemCode": "WIDGET", "taxCode": "P0000000" }],
    "commit": false
  }
}

A later Stripe step charges {{steps.calc_tax.grandTotal | multiply: 100}}.

Live catalog

GET /api/v1/blocks/avalara returns the fields and the three actions. See Block and action discovery.

Errors and limits

  • An Avalara connection is required. Select an account on this step.
  • Document discounts are not supported until Avalara discount totals are verified.
  • Avalara already has a transaction for document code "…" and type "…". Nothing was submitted: use the existing document or a new code.
  • An Avalara transaction already exists for document code "…": AvaTax itself rejected the duplicate.
  • lines must total a negative amount on a ReturnInvoice; taxOverride.taxAmount must be zero or less on a ReturnInvoice.

On this page