> This page is for Documentation, version Integration guides (default).
> For other versions, use one of these documentation indexes:
> - Integration guides (default): https://avalara.ferndocs.com/docs/integration-guides/llms.txt
> - Refactor guides: https://avalara.ferndocs.com/docs/refactor-guides/llms.txt
> - Get certified: https://avalara.ferndocs.com/docs/get-certified/llms.txt
> - Agent to Agent (A2A): https://avalara.ferndocs.com/docs/agent-to-agent-a2a/llms.txt
> - AI use cases: https://avalara.ferndocs.com/docs/ai-use-cases/llms.txt
> - API versioning: https://avalara.ferndocs.com/docs/api-versioning/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://avalara.ferndocs.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://avalara.ferndocs.com/_mcp/server.

# Commit and refund transactions

A recorded transaction (`SalesInvoice`) moves through a lifecycle: it's created, committed for reporting, and later adjusted, voided, or refunded as orders change. Each action is a dedicated endpoint scoped to a company and transaction code.

## Commit

Committing marks a transaction as final so it's included in returns and reports.

### Request

POST [https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/commit](https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/commit)

```curl
curl -X POST https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit \
     -H "Authorization: <apiKey>" \
     -H "Content-Type: application/json-patch+json" \
     -d '{
  "commit": true
}'
```

```typescript
import { AvalaraClient } from "avalara";

async function main() {
    const client = new AvalaraClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.avatax.transactions.commitTransaction({
        companyCode: "companyCode",
        transactionCode: "transactionCode",
        body: {
            commit: true,
        },
    });
}
main();

```

```python
from avalara import Avalara

client = Avalara(
    api_key="YOUR_API_KEY_HERE",
)

client.avatax.transactions.commit_transaction(
    company_code="companyCode",
    transaction_code="transactionCode",
    commit=True,
)

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit"

	payload := strings.NewReader("{\n  \"commit\": true\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json-patch+json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json-patch+json'
request.body = "{\n  \"commit\": true\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json-patch+json")
  .body("{\n  \"commit\": true\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit', [
  'body' => '{
  "commit": true
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json-patch+json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json-patch+json");
request.AddParameter("application/json-patch+json", "{\n  \"commit\": true\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json-patch+json"
]

let postData = NSData(data: "{
  "commit": true
}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/commit")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

## Void

Void a transaction that should never have been recorded — a cancelled order, for example. Voided documents are excluded from reporting.

### Request

POST [https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/void](https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/void)

```curl
curl -X POST https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void \
     -H "Authorization: <apiKey>" \
     -H "Content-Type: application/json-patch+json" \
     -d '{
  "code": "DocVoided"
}'
```

```typescript
import { AvalaraClient } from "avalara";

async function main() {
    const client = new AvalaraClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.avatax.transactions.voidTransaction({
        companyCode: "companyCode",
        transactionCode: "transactionCode",
        body: {
            code: "DocVoided",
        },
    });
}
main();

```

```python
from avalara import Avalara

client = Avalara(
    api_key="YOUR_API_KEY_HERE",
)

client.avatax.transactions.void_transaction(
    company_code="companyCode",
    transaction_code="transactionCode",
    code="DocVoided",
)

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void"

	payload := strings.NewReader("{\n  \"code\": \"DocVoided\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json-patch+json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json-patch+json'
request.body = "{\n  \"code\": \"DocVoided\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json-patch+json")
  .body("{\n  \"code\": \"DocVoided\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void', [
  'body' => '{
  "code": "DocVoided"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json-patch+json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json-patch+json");
request.AddParameter("application/json-patch+json", "{\n  \"code\": \"DocVoided\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json-patch+json"
]

let postData = NSData(data: "{
  "code": "DocVoided"
}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/void")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

Pass a `code` describing why:

```json
{ "code": "DocVoided" }
```

## Refund

Issue a refund against a committed invoice. AvaTax creates a linked `ReturnInvoice` with the reversed tax.

### Request

POST [https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/refund](https://rest.avatax.com/api/v2/companies/\{companyCode}/transactions/\{transactionCode}/refund)

```curl
curl -X POST https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund \
     -H "Authorization: <apiKey>" \
     -H "Content-Type: application/json-patch+json" \
     -d '{
  "refundDate": "2026-07-06",
  "refundTransactionCode": "2bcc9dd4-a822-4edc-86fc-e93130e3d8fe",
  "refundType": "Full",
  "referenceCode": "Refund for a committed transaction"
}'
```

```typescript
import { AvalaraClient } from "avalara";

async function main() {
    const client = new AvalaraClient({
        apiKey: "YOUR_API_KEY_HERE",
    });
    await client.avatax.transactions.refundTransaction({
        companyCode: "companyCode",
        transactionCode: "transactionCode",
        body: {
            refundTransactionCode: "2bcc9dd4-a822-4edc-86fc-e93130e3d8fe",
            refundDate: "2026-07-06",
            refundType: "Full",
            referenceCode: "Refund for a committed transaction",
        },
    });
}
main();

```

```python
from avalara import Avalara
import datetime

client = Avalara(
    api_key="YOUR_API_KEY_HERE",
)

client.avatax.transactions.refund_transaction(
    company_code="companyCode",
    transaction_code="transactionCode",
    refund_transaction_code="2bcc9dd4-a822-4edc-86fc-e93130e3d8fe",
    refund_date=datetime.date.fromisoformat("2026-07-06"),
    refund_type="Full",
    reference_code="Refund for a committed transaction",
)

```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund"

	payload := strings.NewReader("{\n  \"refundDate\": \"2026-07-06\",\n  \"refundTransactionCode\": \"2bcc9dd4-a822-4edc-86fc-e93130e3d8fe\",\n  \"refundType\": \"Full\",\n  \"referenceCode\": \"Refund for a committed transaction\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "<apiKey>")
	req.Header.Add("Content-Type", "application/json-patch+json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = '<apiKey>'
request["Content-Type"] = 'application/json-patch+json'
request.body = "{\n  \"refundDate\": \"2026-07-06\",\n  \"refundTransactionCode\": \"2bcc9dd4-a822-4edc-86fc-e93130e3d8fe\",\n  \"refundType\": \"Full\",\n  \"referenceCode\": \"Refund for a committed transaction\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund")
  .header("Authorization", "<apiKey>")
  .header("Content-Type", "application/json-patch+json")
  .body("{\n  \"refundDate\": \"2026-07-06\",\n  \"refundTransactionCode\": \"2bcc9dd4-a822-4edc-86fc-e93130e3d8fe\",\n  \"refundType\": \"Full\",\n  \"referenceCode\": \"Refund for a committed transaction\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund', [
  'body' => '{
  "refundDate": "2026-07-06",
  "refundTransactionCode": "2bcc9dd4-a822-4edc-86fc-e93130e3d8fe",
  "refundType": "Full",
  "referenceCode": "Refund for a committed transaction"
}',
  'headers' => [
    'Authorization' => '<apiKey>',
    'Content-Type' => 'application/json-patch+json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "<apiKey>");
request.AddHeader("Content-Type", "application/json-patch+json");
request.AddParameter("application/json-patch+json", "{\n  \"refundDate\": \"2026-07-06\",\n  \"refundTransactionCode\": \"2bcc9dd4-a822-4edc-86fc-e93130e3d8fe\",\n  \"refundType\": \"Full\",\n  \"referenceCode\": \"Refund for a committed transaction\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "<apiKey>",
  "Content-Type": "application/json-patch+json"
]

let postData = NSData(data: "{
  "refundDate": "2026-07-06",
  "refundTransactionCode": "2bcc9dd4-a822-4edc-86fc-e93130e3d8fe",
  "refundType": "Full",
  "referenceCode": "Refund for a committed transaction"
}".data(using: String.Encoding.utf8)!)

let request = NSMutableURLRequest(url: NSURL(string: "https://rest.avatax.com/api/v2/companies/companyCode/transactions/transactionCode/refund")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```

**`Full refund of a plant order`**

```json title="Full refund of a plant order"
{
  "refundTransactionCode": "INV-1001-R",
  "refundType": "Full",
  "refundDate": "2026-07-10"
}
```

## Choosing the right action

#### The order changed before shipping

Use `adjust` to replace the document's lines while keeping the same transaction code and history.

#### The order was cancelled

Use `void` with the `DocVoided` reason so the transaction drops out of reporting entirely.

#### The customer returned an item

Use `refund` to record the reversed tax as a linked return, preserving the original invoice.

> **Warning**
>
> Void and refund are not interchangeable. Voiding erases the record; refunding preserves the original invoice and books an offsetting return. Choose based on whether money actually moved.