# Customer code

Source: https://developer.avalara.com/avatax-for-vat/kkp5395165822080/

# Customer code

Learn about the customer code field, its requirements, and how it’s used in transactions.

**Element type:** Required

**Endpoints/models used:** [CreateTransactionModel](https://developer.avalara.com/api-reference/avatax/rest/v2/models/CreateTransactionModel/)

Your integration must include a field that allows users to input the merchant-facing customer code (number, ID) that will be passed to the AvaTax service in the transaction. This can be done using the `customerCode` field in the [CreateTransactionModel](https://developer.avalara.com/api-reference/avatax/rest/v2/models/CreateTransactionModel/). Customer codes are case sensitive and unique across your company. In addition, customer codes can be a maximum of 50 characters.

Some integrations have an internal GUID as a customer identifier along with a merchant-facing or vendor facing-customer identifier. So, in the UI, you might see a customer ID, but the back end contains another string that identifies that particular merchant or vendor.

When used in transactions, if the `transactiontype` is `SalesInvoice`, the transaction is deemed to be a sale to a buyer identified by the `customerCode`. In this case, use the ID of the customer for the `customerCode`. Similarly, if the `transactiontype` is `PurchaseInvoice`, the transaction is deemed to be a purchase from a vendor identified by the `customerCode`. In this case, use the vendor ID for the `customerCode`.

**Example**

```
{
  "type": "SalesInvoice",
  "companyCode": "DEFAULT",
  "date": "2024-07-16",
  "code": "MyDocumentCode",
  "customerCode": "ABC",
  "purchaseOrderNo": "123456789",
  "commit": true,
  "currencyCode": "USD",
  "description": "Yarn",
  ...,
}
```