Avalara Developer Network Developer communications

Chapter 3.1 - Commit Request

There are two ways to commit and uncommit DocumentCodes:

  • Commit API
  • Commit field (cmmt) directly in the transaction

This page covers the Commit API. The transaction-level Commit can be found here.

Commit Endpoint

Endpoint Description
/api/v2/afc/commit POST Commits and Uncommits transactions. See Commit/Uncommit for more information.

Commit API Data Fields

The following fields must be provided within a Commit API call in order to support the Commit/Uncommit feature.
Key Value
doc [string] DocumentCode
150-character max user-defined field that identifies a transaction, quote, or invoice in the calling system. The value is provided by the user when performing the tax calculation.
cmmt [bool] Commit
true: The transaction should be committed
false: The transaction should be uncommitted
opt [OptionalFields] optional Key value Pair
List of Key Value Pairs to provide additional information

The Commit Request

The Commit request is used to change the Commit flag for a given DocumentCode. Let's send a simple Commit call using Postman and inspect the results.

Headers

Add the following mandatory headers to your request:
  • api_key
  • client_id
  • Content-Type: application/json

Postman example

Body

For the body of the POST request, copy and paste the following example:
{
  "doc": "DocumentXYZ123",
  "cmmt": true,
  "opt": [
    {
      "key": 1,
      "val": "Optional value"
    }
  ]
}

What are we sending?

The example above assumes you have submitted transactions for the current reporting cycle with a DocumentCode (doc) of "123456789". The doc key identifies the DocumentCode you want to update. The DocumentCode can be associated with a bill run, an invoice, a customer, or a transaction. Next comes the Commit flag (cmmt). Set this flag to true to mark the DocumentCode (doc) as committed or false to uncommit the DocumentCode. Reminder: this action commits or uncommits all transactions with this DocumentCode. Last is the optional Key Value Pair (opt). This is where optional information about the commit batch, transactions, customer, etc. can be stored.

Response

The Commit response contains a confirmation of success or failure:
{
  "ok": true
}
An ok status of true means that the DocumentCode (doc) was committed or uncommitted successfully depending on the value of the Committed (cmmt) flag. If false is returned in the ok key, an error code (code) and the error message (msg) are returned.