# getTax refactor to CreateTransaction

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

# getTax refactor to CreateTransaction

Understand how to refactor from the `getTax` SOAP API to the CreateTransaction RESTv2 API, including field differences and additional parameters.

This example shows how to refactor from [getTax](https://developer.avalara.com/api-reference/avatax/soap/methods/getTax/) in SOAP to [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) in RESTv2. It also includes a table showing the differences in the fields that are included in each API. In addition to these differences, the RESTv2 endpoint provides many more parameters that can be specified in a transaction. You can learn more about each of these parameters in the documentation for the [CreateTransaction](https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/CreateTransaction/) endpoint.

SOAP

RESTv2

`Commit`

`commit`

`CompanyCode`

`companyCode`

`CustomerCode`

`customerCode`

`DocCode`

`code`

`DocType`

`type`

`DocDate`

`date`

`Lines`

`lines`

`Addresses`

`addresses`

`LineNo`

`number`

`DestinationCode`

N/A. This comes from the `addresses` object.

`OriginCode`

N/A. This comes from the `addresses` object.

`ItemCode`

`itemCode`

`TaxCode`

`taxCode`

`Description`

`description`

`Qty`

`quantity`

`Amount`

`amount`

`HashCode`

N/A

`ReferenceCode`

`referenceCode`

`CurrencyCode`

`currencyCode`

`ServiceMode`

`serviceMode`

`DetailLevel`

`debugLevel`

`ParameterBagItems`

`parameters`

`UserDefinedFields`

`userDefinedFields`

`MerchantSellerId`

`merchantSellerIdentifier`

`MarketplaceLiabilityType`

`marketplaceLiabilityType`

`TaxAmountByTaxTypes`

`taxAmountByTaxTypes`

`DeemedSellerType`

N/A

## Examples

**SOAP**

```
POST https://development.avalara.net/Tax/TaxSvc.asmx/V2
         appTest Refactor SOAP API       SalesOrder  2021-10-29 MAW Guest ORIG2 DEST3   ORIG2    Bainbridge WA 98110 US 0     DEST3   AL 36703 US 0       ORIG2 ShipFrom   DEST3 ShipTo     1 ORIG2 DEST3 1 799.0      Growth Monthly    ORIG2 ShipFrom   DEST3 ShipTo            Tax  0  false USD Automatic   
```

**REST V2**

```
curl
  -X POST
  -H 'Accept: application/json'
  -H 'Authorization: Basic ${btoa(`:`)}'
  -H 'Content-Type: application/json'
  --data '{
    "companyCode": "",
    "code": "",
    "type": "SalesOrder",
    "customerCode": "TestCustomer",
    "addresses": {
      "SingleLocation": {
        "line1": "201 E North St",
        "city": "Magnolia",
        "region": "AR",
        "country": "US",
        "postalCode": "71753"
      }
    },
    "lines": [{
      "number": "Line 1",
      "quantity": 1,
      "amount": 100,
      "taxCode": "P0000000",
      "itemCode": "P12345",
      "description": "Item Description"
    }],
    "date": "2024-10-29T17:29:10.503Z"
  }
  'https://sandbox-rest.avatax.com/api/v2/transactions/create'
```