# Scaling: Multiple invoices

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

Guide: Communications

# Scaling: Multiple invoices

This example shows how to run a single request that includes 2 invoices. For both invoices in this request:

-   Customer type is `0` (Residential)

-   Bill-to PCode is `1363100`

-   Charge for the transaction is $500

-   T/S pair is `57/674` (Digital Goods/Streaming Video - OTT - Live)

## 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": "BatchingInvoices", //--Document Code:  Required.  A unique value that is used to Commit transactions through the Commit API. Do NOT use InvoiceNumber.  GUID preferable. Every unique call must have a unique "doc".    "cmmt": false, //--Commit:  Required.  The status of transaction for end of period compliance reporting.  Previously CalcTaxes uncommitted transactions can be committed through the Commit API.    "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-04-21",    "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",    "custref": "CertTest0",    "invn": "Invoice-01",    "bcyc": "202204",    "bpd": { //--Billing Period Object: Used for reporting.
"month": "04",
"year": "2022"    },    "opt": [
{
    "key": "1",
    "val": "FP0"  //Idea for locating FP and incorporting in a SelfTest API Endpoint
}    ]},{    "doc": "BatchingInvoices", //--Document Code:  Required.  A unique value that is used to Commit transactions through the Commit API. Do NOT use InvoiceNumber.  GUID preferable. Every unique call must have a unique "doc".    "cmmt": false, //--Commit:  Required.  The status of transaction for end of period compliance reporting.  Previously CalcTaxes uncommitted transactions can be committed through the Commit API.    "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-04-21",    "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",    "custref": "CertTest0",    "invn": "Invoice-02",    "bcyc": "202204",    "bpd": { //--Billing Period Object: Used for reporting.
"month": "04",
"year": "2022"    },    "opt": [
{
    "key": "1",
    "val": "FP0"  //Idea for locating FP and incorporting in a SelfTest API Endpoint
}    ]}
    ]
}'
```

## Response

**View example**:

```
{
    "inv": [{    "doc": "BatchingInvoices",    "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",
"invn": "Invoice-01",
"bcyc": "202204"    }},{    "doc": "BatchingInvoices",    "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",
"invn": "Invoice-02",
"bcyc": "202204"    }}
    ]
}
```