# cancelTax refactor to VoidTransaction

Source: https://developer.avalara.com/soap-to-restv2-refactor-guide/nzk4764859766229/

# cancelTax refactor to VoidTransaction

Understand how to refactor from cancelTax in SOAP to VoidTransaction in RESTv2, including field differences.

This example shows how to refactor from [cancelTax](https://developer.avalara.com/api-reference/avatax/soap/methods/cancelTax/) in SOAP to [VoidTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/VoidTransaction/) in RESTv2. It also includes a table showing the differences in the fields that are included in each API.

SOAP

RESTv2

`DocId`

N/A

`CompanyCode`

N/A. The `companyCode` is specified in the request URL.

`DocType`

N/A. Optionally include the document `type` in the request URL.

`DocCode`

N/A. The document `code` is specified in the request URL.

`CancelCode`

N/A

## Examples

**SOAP**

```
POST https://development.avalara.net/Tax/TaxSvc.asmx/v2
         appTest Refactor SOAP API        {{companyCode}} SalesInvoice {{documentCode}} DocVoided   
```

**REST V2**

```
curl
  -X POST
  -H 'Authorization: Basic ${btoa(`:`)}'
  -H 'Content-Type: application/json'
  --data '{
    "code": "DocVoided"
  }'
  'https://sandbox-rest.avatax.com/api/v2/companies/CINC/transactions/12345/void'
```