# DIL: Create an invoice

Source: https://developer.avalara.com/products/communications/integration-guides/communications-integration/zxs4921824372052/

Guide: Communications

# DIL: Create an invoice

After you provide a quote and a customer accepts the amount, the next step is to use the [CalculateTaxes](https://developer.avalara.com/api-reference/communications/v2/methods/Tax%20Calculation/CalculateTaxes/) endpoint with an invoice number to create an invoice for the customer. The invoice number must match the Billing Invoice reference value so the data can be reconciled between systems.

## Request

**View example**:

```
curl --location --request POST 'https://communicationsua.avalara.net/api/v2/afc/CalcTaxes' \
--header 'client_id: 787' \
--header 'Authorization: Basic {Base64-encoded credentials} \
--header 'Content-Type: application/json' \
--data-raw '{
    "cfg": {"incrf": true //--Return Reporting Information.
    },
    "cmpn": {"bscl": 1, //--Business Class: Typical value is "1". Is the provider and an Incumbant Local Exchange Carrier ("ILEC",  basically those companies that own the wire, antennas and switches of a network) or not?   0=ILEC, 1=NOT an ILEC (or Competitive Local Exchange Carrier "CLEC"). Streaming default to "1""svcl": 0, //--Service Class:  Is the provider Primarily a local service provider, or long distance?   0=Primary Local; 1=Primary Long Distance.  Streaming default: 0."fclt": false, //--Facilities:  Does the company providing the service have facilities to provide the service?  Streaming default: false."frch": false, //--Franchise:  Indicates if the company provides services sold pursuant to a franchise agreement between the carrier and jurisdiction. Streaming default: false."reg": false, //--Regulated:  Is the Seller is regulated?  Streaming default: false."idnt": "CertCompany"
    },
    "inv": [{    "doc": "", //--Document Code:  Required.  GUID preferable. Every unique call must have a unique "doc".      "bill": { //--Bill To Object:  Calculates taxed based on the granularity of the address. Options include: passing only Preassigned Pcode value in PCD value via the GEO/PCODE APIs.  The actual address fields: the more granular the address, the more accurate the results.
"pcd": 1363100    },    "cust": 0, //--Customer Type: Required.  Default to "0" for Streaming.    "date": "2022-03-02",    "itms": [
{
    "ref": "1_CertTest0_PCD_Only_StreamingVideo",
    "chg": 500,
    "sale": 1,
    "incl": false,
    "tran": 57,
    "serv": 674,
    "adj": false
}    ],    "invm": true, //--Returns Summary Tax Object for Invoice Presentation    "dtl": true, //--Returns Line Item Detail Taxes    "summ": true,    "acct": "CertCompany", //???  This is a conversation we need to have with Ryan and Pat i.e. NetSuite One World    "custref": "CertTest0", //uniquely identifies the customer in billing system    "invn": "", // Must match the Billing Invoice reference value so data can be reconciled between systems    "bcyc": "202203",    "bpd": { //--Billing Period Object: Used for reporting.
"month": "03",
"year": "2022"    }}
    ]
}'
```

## Response

**View example**:

```
{
    "inv": [{    "doc": "",    "itms": [
{
    "ref": "1_CertTest0_PCD_Only_StreamingVideo",
    "txs": [{    "bill": true,    "cmpl": true,    "tm": 512.0,    "calc": 1,    "cat": "UTILITY USER TAXES",    "cid": 8,    "name": "Utility Users Tax (Cable Television)",    "exm": 0.0,    "lns": 0,    "min": 0.0,    "pcd": 1362800,    "rate": 0.03,    "sur": true,    "tax": 15.36,    "lvl": 2,    "tid": 71},{    "bill": true,    "cmpl": true,    "tm": 500.0,    "calc": 1,    "cat": "GROSS RECEIPTS TAXES",    "cid": 3,    "name": "Statutory Gross Receipts NF (Video)",    "exm": 0.0,    "lns": 0,    "min": 0.0,    "pcd": 1362800,    "rate": 0.024,    "sur": false,    "tax": 12.0,    "lvl": 1,    "tid": 534},{    "bill": true,    "cmpl": true,    "tm": 500.0,    "calc": 1,    "cat": "EXCISE TAXES",    "cid": 4,    "name": "Excise Tax NF",    "exm": 0.0,    "lns": 0,    "min": 0.0,    "pcd": 1362800,    "rate": 0.03,    "sur": false,    "tax": 15.0,    "lvl": 1,    "tid": 533}
    ]
}    ],    "summ": [
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 512.0,
    "calc": 1,
    "cat": "UTILITY USER TAXES",
    "cid": 8,
    "name": "Utility Users Tax (Cable Television)",
    "exm": 0.0,
    "lns": 0,
    "pcd": 1362800,
    "rate": 0.03,
    "sur": false,
    "tax": 15.36,
    "lvl": 2,
    "tid": 71
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 500.0,
    "calc": 1,
    "cat": "GROSS RECEIPTS TAXES",
    "cid": 3,
    "name": "Statutory Gross Receipts NF (Video)",
    "exm": 0.0,
    "lns": 0,
    "pcd": 1362800,
    "rate": 0.024,
    "sur": false,
    "tax": 12.0,
    "lvl": 1,
    "tid": 534
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 500.0,
    "calc": 1,
    "cat": "EXCISE TAXES",
    "cid": 4,
    "name": "Excise Tax NF",
    "exm": 0.0,
    "lns": 0,
    "pcd": 1362800,
    "rate": 0.03,
    "sur": false,
    "tax": 15.0,
    "lvl": 1,
    "tid": 533
}    ],    "incrf": {
"acct": "CertCompany",
"custref": "CertTest0",
"bcyc": "202203"    }}
    ]
}
```