# Non-compliant purchase

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

# Non-compliant purchase

This example show a non-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:`PA2020301`.
-   The`routeType` is a valid type for compliance verification:`DTC`.
-   The quantity of alcohol being purchased is greater than the legal limit.
-   The purchaser is under 21 years old.
-   The recipient is under 21 years old.

When verifying a beverage alcohol transaction, AvaTax will perform a number of checks on the line items, address, and parameters. There are a number of reasons that will cause a transaction to fail a compliance check, and as shown in this example, the response provides a human-readable, easy-to-understand reason for the failure.

### Transaction request

The following transaction shows a request for purchasing packaged alcohol sparkling wine.

```
curl  -X POST  -H 'Accept: application/json'  -H 'Authorization: Basic aHR0cHdhdQNoOmY='  -H 'Content-Type: application/json'  --data '{    "type":"SalesInvoice",    "code": "123434390847",    "companyCode":"DEFAULT",    "customerCode":"13434",    "date":"2021-03-10",    "commit":true,    "lines": [      {        "number":"1",        "quantity":10,        "amount":100,        "taxCode":"PA2020301",        "itemCode":"12345",        "description":"Packaged alcohol sparkling wine",        "parameters":[          {              "name":"AlcoholRouteType",              "value":"DTC"          },          {              "name":"RecipientName",              "value":"John Smith"          },          {              "name":"PurchaserDOB",              "value":"2002-07-31"          },          {              "name":"RecipientDOB",              "value":"2002-08-02"          },          {              "name":"ContainerSize",              "value":"1",              "unit":"Litre"          },          {              "name":"AlcoholContent",              "value":"12.2",              "unit":"Percentage"          },          {              "name":"PackSize",              "value":"12",              "unit":"Count"          },          {              "name":"NetVolume",              "value":"750",              "unit":"Millilitre"          }        ]      }    ],    "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`123434390847`.

```
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/123434390847/shipment/verify'
```

### Response

The response returns`"compliant": false`. In this response, the`successMessages` for line 1 describes the checks that passed verification. In this case, a license exists for Kentucky is the only check that passed. The`failureMessages` shows all of the other reasons that make this transaction non-compliant.

```
{  "compliant": false,  "warningCodes": [],  "message": "Transaction is not compliant",  "successMessages": "Line \"1\": A current license exists for KENTUCKY.\n",  "failureMessages": "Line \"1\": The recipient is younger than 21 years of age; The purchaser is younger than 21 years of age.\n",  "failureCodes": [    "BelowLegalDrinkingAge"  ],  "lines": [    {      "resultCode": "NotCompliant",      "lineNumber": "1",      "message": "Line is not compliant",      "successMessages": "A current license exists for KENTUCKY.",      "failureMessages": "The recipient is younger than 21 years of age; The purchaser is younger than 21 years of age.",      "failureCodes": [        "BelowLegalDrinkingAge"      ]    }  ]}
```

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

[Next](/avatax-for-bevalc/examples/example-unsupported-address)