# Misc: Streaming with termination

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

Guide: Communications

# Misc: Streaming with termination

This example shows how to use AFC calculate taxes for streaming video T/S pairings with termination. This example includes 4 lines. In this example:

-   Customer type is `0` (Residential)

-   Bill-to PCode is `3137100`

-   To PCode is `3726100`

-   Line 1 T/S pair is `57/672` (Digital Goods/Streaming Video - On-Net - Live)

-   Line 2 T/S pair is `57/673` (Digital Goods/Streaming Video - On-Net - On Demand)

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

-   Line 4 T/S pair is `57/675` (Digital Goods/Streaming Video - OTT - On Demand)

## Request

**View example**:

```
curl --location --request POST 'https://communicationsua.avalara.net/api/v2/afc/CalcTaxes' \
--header 'client_id: 787' \
--header 'client_profile_id;' \
--header 'Authorization: Basic {Base64-encoded credentials}' \
--header 'Content-Type: application/json' \
--data-raw '{ // Author MJ Nelson
    "cmpn": { //--The Company Object.  REQUIRED.  This object has data elements that are normally managed via textboxes / checkboxes in a Company Admin screen of the billing platform itself.  You of course can hard code these values if that is more expedient and the company'\''s business model is static."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.
    },
    "inv": [{    "doc": "StreamingContent1", //--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": {
 "int": true, //--Optional: Incorporated.  Is the location within an Incorporated city.   Default to '\''true'\'' if not a tangible field within the billing platform.  Pass '\''addr'\'','\''city'\'','\''st'\'','\''zip'\'','\''ctry'\'' and you can not pass at all.  Pre-assign PCODE via GEO or PCode API, and not needed.
"pcd": 3137100 //--Optional: PCode:  You can pass only this value in the BillTo object.  Preassigned values are handled via the GEO and PCODE APIs.    },    "to": {
    "int" : true,
    "pcd": "3726100"
  },    "cust": 0, //--Customer Type: Required.  Default to "0" for Streaming.    "date": "2021-07-01T12:00:00Z",    "itms": [
{
    "ref": "StreamingVideo_OnNetLive", //--Invoice Line Number
     "chg": 100, //--Charge amount in native currency of "bill"
    "sale": 1, //--Sale Type:  0=Wholesale, 1=Retail, 2=Consumed (Sales and Use Only), 3=Vendor Use. REQUIRED. Streaming default to "1"
    "incl": false, //--Tax Inclusive:  Indicates if "chg" has tax already included in the amount.
    "tran": 57, //--Transaction Type: Industry vertical...see mapping guidelines for this. REQUIRED
    "serv": 672, //--Service Type:  Billable services for an industry vertical....see mapping guidelines for this. REQUIRED
    "adj": false //--Adjustment:  True, will negate taxes. False, will return positive taxes.  Default is False.
},
{
    "ref": "StreamingVideo_OnNetOnDemand",
    "chg": 100,
    "sale": 1,
    "incl": false,
    "tran": 57,
    "serv": 673,
    "adj": false
},
{
    "ref": "StreamingVideo_OTTLive",
    "chg": 100,
    "sale": 1,
    "incl": false,
    "tran": 57,
    "serv": 674,
    "adj": false
},
{
    "ref": "StreamingVideo_OTTDemand",
    "chg": 100,
    "sale": 1,
    "incl": false,
    "tran": 57,
    "serv": 675,
    "adj": false
}    ],    "invm": true,    "dtl": true,    "summ": true,    "acct": "Broadcaster", //--Account Reference: Optional.  Return an account reference in the Response.    "custref": "Customer1234", //--Customer Reference: Required. Return a customer reference in the Response.    "invn": "Invoice1234", //--Invoice Number Reference: Required.  Used for reporting.    "bcyc": "202107", //--Bill Cycle Reference: Required. Used for reporting.    "bpd": { //--Billing Period Object: Used for reporting.
"month": "07",
"year": "2021"    },    "opt": [
{
    "key": "1",
    "val": "StreamingSamples"
}    ]}
    ]
}'
```

## Response

**View example**:

```
{
    "inv": [{    "doc": "StreamingContent1",    "itms": [
{
    "ref": "StreamingVideo_OnNetLive",
    "txs": [{    "bill": true,    "cmpl": true,    "tm": 100.0,    "calc": 2,    "cat": "CABLE REGULATORY FEES",    "cid": 11,    "name": "FCC Regulatory Fee",    "exm": 0.0,    "lns": 0,    "min": 0.0,    "pcd": 0,    "rate": 0.081667,    "sur": false,    "tax": 0.081667,    "lvl": 0,    "tid": 72}
    ]
},
{
    "ref": "StreamingVideo_OnNetOnDemand",
    "txs": []
},
{
    "ref": "StreamingVideo_OTTLive",
    "txs": []
},
{
    "ref": "StreamingVideo_OTTDemand",
    "txs": []
}    ],    "summ": [
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 100.0,
    "calc": 2,
    "cat": "CABLE REGULATORY FEES",
    "cid": 11,
    "name": "FCC Regulatory Fee",
    "exm": 0.0,
    "lns": 0,
    "pcd": 0,
    "rate": 0.081667,
    "sur": false,
    "tax": 0.081667,
    "lvl": 0,
    "tid": 72
}    ]}
    ]
}
```