# Compliant purchase

Source: https://developer.avalara.com/avatax-for-bevalc/examples/example-compliant/

# Compliant purchase

This example show a compliant beverage alcohol sales invoice transaction. In this example:

-   A valid license exists for shipping to Kentucky.
-   The`taxCode` is a valid code for compliance verification:`PA2020100`.
-   The`routeType` is a valid type for compliance verification:`DTC`.
-   The quantity of alcohol being purchased is within the legal limit.
-   The purchaser is at least 21 years old.
-   The recipient is at least 21 years old.

### Transaction request

The following transaction shows a request for purchasing both packaged alcohol spirits and wine glasses.

```
curl    -X POST    -H 'Accept: application/json'    -H 'Authorization: Basic aHR0cHdhdQNoOmY='    -H 'Content-Type: application/json'    --data '{      "type":"SalesInvoice",      "code": "CompliantPurchase",      "companyCode":"DEFAULT",      "customerCode":"13434",      "date":"2022-08-15",      "commit":true,      "lines": [        {          "number":"1",          "quantity":3,          "amount":100,          "taxCode":"PA2020100",          "itemCode":"12345",          "description":"Packaged alcohol spirits",          "parameters":[              {                  "name":"AlcoholRouteType",                  "value":"DTC"              },              {                  "name":"RecipientName",                  "value":"John Smith"              },              {                  "name":"RecipientDOB",                  "value":"2000-01-02"              },              {                  "name":"PurchaserName",                  "value":"Jane Smith"              },              {                  "name":"PurchaserDOB",                  "value":"1995-03-29"              },              {                  "name":"ContainerSize",                  "value":"750",                  "unit":"Millilitre"              },              {                  "name":"AlcoholContent",                  "value":"80",                  "unit":"Percentage"              },              {                  "name":"PackSize",                  "value":"1",                  "unit":"Count"              },              {                  "name":"NetVolume",                  "value":"750",                  "unit":"Millilitre"              },              {                  "name":"Brand",                  "value":"Premier"              },              {                  "name":"CarrierCode",                  "value":"UPS"              },              {                  "name":"IsAlcoholSample",                  "value":false              },              {                  "name":"IsDirectAlcoholImport",                  "value":false              },              {                  "name":"IsForeignAlcohol",                  "value":false              },              {                  "name":"SalesLocation",                  "value":"offsite"              },              {                  "name":"SellerClassification",                  "value":"OutOfStateDirectShipper"              },              {                  "name":"ShipDate",                  "value":"2022-08-16"              },              {                  "name":"TrackingNumber",                  "value":"1Z654321MB12345678"              }          ]        },         {          "number":"2",          "quantity":1,          "amount":10,          "taxCode":"PG068810",          "itemCode":"12348",          "description":"Cabernet wine glasses"        }      ],      "addresses": {        "shipFrom":{          "line1":"255 S King St",          "line2":"Suite 1200",          "city":"Seattle",          "region":"WA",          "country":"US",          "postalCode":"98104"        },        "shipTo":{          "line1":"2100 S Floyd St",          "city":"Louisville",          "region":"KY",          "country":"US",          "postalCode":"40292"        }      }    }'    'https://sandbox-rest.avatax.com/api/v2/transactions/create'
```

### Verification request

In the verification request, be sure to include your`companyCode` and the transaction`code`. In the transaction above, the`companyCode` is`DEFAULT`, and the transaction`code` is`CompliantPurchase`.

```
curl    -X GET    -H 'Accept: application/json'    -H 'Authorization: Basic aHR0cHdhdQNoOmY='    -H 'Content-Type: application/json'    'https://sandbox-rest.avatax.com/api/v2/companies/DEFAULT/transactions/CompliantPurchase/shipment/verify'
```

### Response

The response returns`"compliant": true`. In addition, the`successMessages` for line 1 describes how each check in the transaction passed compliance verification. Also notice that the message for line 2 indicates that the line references an unsupported tax code. This message is deliberate and simply means that a compliance check was not performed on that line because only supported beverage alcohol tax codes are verified.

```
{  "compliant": true,  "warningCodes": [    "UnsupportedTaxCode"  ],  "message": "Transaction is compliant",  "successMessages": "Line \"1\": A current license exists for KENTUCKY; The recipient is older than 21 years of age; The purchaser is older than 21 years of age; The Per Individual volume limit in KENTUCKY is 90 Litre(s) per 1 month. Including registered shipments, 90 Litre(s) would be shipped to this Individual in a 1 month timeframe. Therefore, the volume in this transaction is under the volume limit.\n",  "failureMessages": "",  "failureCodes": [],  "lines": [    {      "resultCode": "Compliant",      "lineNumber": "1",      "message": "Line is compliant",      "successMessages": "A current license exists for KENTUCKY; The recipient is older than 21 years of age; The purchaser is older than 21 years of age; The Per Individual volume limit in KENTUCKY is 90 Litre(s) per 1 month. Including registered shipments, 90 Litre(s) would be shipped to this Individual in a 1 month timeframe. Therefore, the volume in this transaction is under the volume limit.",      "failureMessages": "",      "failureCodes": []    },    {      "resultCode": "UnsupportedTaxCode",      "lineNumber": "2",      "message": "Line refers to an unsupported tax code",      "successMessages": "",      "failureMessages": "",      "failureCodes": []    }  ]}
```

[Previous](/avatax-for-bevalc/requirements/varietal)

[Next](/avatax-for-bevalc/examples/example-non-compliant)