# Aggregation: Minutes

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

Guide: Communications

# Aggregation: Minutes

This example demonstrates how AFC can aggregate minutes (`min`) in a transaction. Assuming your transactions uses the same T/S pairing and Locations, you can summarize your minutes into an aggregate amount.

In this example:

-   Customer type is `0` (Residential)

-   Bill-to address is in NY, NY

-   Charge for the transaction is $0.10

-   Number of minutes is 3

-   Number of lines is 0

-   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")"svcl": 0, //--Service Class:  Is the provider Primarily a local service provider, or long distance?   0=Primary Local; 1=Primary Long Distance. "fclt": false, //--Facilities:  Does the company providing the service have facilities to provide the service?      "frch": false, //--Franchise:  Indicates if the company provides services sold pursuant to a franchise agreement between the carrier and jurisdiction."reg": false, //--Regulated:  Is the Seller is regulated?"idnt": "CertCompany"
    },
    "inv": [{    "doc": "Only_IntrastateWireline2c536ad9-b8dc-4ab8-885e-07d56223ff13", //--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:  Required.  Field usually originating from a customer account profile. The SoldTo address of the transaction.  AFC will return the level of granularity in taxation based on the granularity of the address provided.  This object can be JUST PCode value if you utilize the GEO or PCODE APIs for assigning a PCODE to a location.
"ctry": "USA", //--Country ISO Code
"int": true, //--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.
"addr": "", //--Address: Street Address
"city": "New York", //--City:  City Name
"st": "NY", //--State or Province
"zip": "10101" //--Zip or Canadian Postal Code    },    "cust": 1, //--Customer Type: Required.  In this Use Case, default to 1.  Line Level "cust" field below applied on the CDR for the line item.    "lfln": false, //--Lifeline:  Field usually originating from a customer account profile.  Is the customer a lifeline participants?    "date": "2022-04-21", //--Date:  Effective Tax Rate Date to be applied to the invoice.  Most often Invoice Date generated through SysDate on the bill run.    "itms": [
{
    "ref": "Only_IntrastateWireline Aggregating Charges and minutes", //--Reference Code.  Reference Id for a line item."from": {"npa": 212220 //--NPANXX: You can pass the area code, local exchange values for a phone number in USA/CAN and AFC will tax based on the phone exchange location
    },
    "to": {"npa": 518269 //--NPANXX: You can pass the area code, local exchange values for a phone number in USA/CAN and AFC will tax based on the phone exchange location
    },
    "chg": 0.10, //--Charge:  Required.  Billed pre-tax amount if "incl"=false.  Billed after tax amount if "incl"=true.
      "min": 3, //--Minutes:  Number of minutes used.  Used for taxed based on usage.
    "line": 0, //--Lines:  Number of phone lines to be taxed.  Required for certain T/S Pairs.
    "sale": 1, //--Sale:  Sale Type:  0=Wholesale, 1=Retail, 2=Consumed (Sales and Use Only), 3=Vendor Use. REQUIRED
    "tran": 2, //--Transaction Type: Industry vertical...see mapping guidelines for this. REQUIRED
    "serv": 1, //--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.
    "cust": 0 //--Item Level Customer Type. Typically resides on the customer master in the source system.  Any line level field populated will override the invoice level field. 0:Residential, 1:Business, 2:Senior Citizen, 3:Industrial
}    ],    "invm": true, // When the BillTo or Termination endpoints vary at the line level set this flag to false to avoid related record dependency calculation errors     "dtl": false,    "summ": true,    "acct": "CertCompany",    "custref": "CertTest1A",    "invn": "CertTest1A",    "bcyc": "202204",    "bpd": {
"month": 04,
"year": 2022    }}
    ]
}'
```

## Response

**View example**:

```
{
    "inv": [{    "doc": "Only_IntrastateWireline5e254979-1c91-42d7-8636-91ca773966a9",    "itms": [
{}    ],    "summ": [
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.07018375,
    "calc": 1,
    "cat": "BUSINESS TAXES",
    "cid": 2,
    "name": "NY Franchise 184 Usage",
    "exm": 0.03007875,
    "lns": 0,
    "pcd": 2502500,
    "rate": 0.00375,
    "sur": false,
    "tax": 0.00026319,
    "lvl": 1,
    "tid": 46
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.10335819,
    "calc": 1,
    "cat": "EXCISE TAXES",
    "cid": 4,
    "name": "NY MCTD 186c",
    "exm": 0.0,
    "lns": 0,
    "pcd": 2604000,
    "rate": 0.00595,
    "sur": false,
    "tax": 0.00061498,
    "lvl": 2,
    "tid": 27
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.10337817,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "NY Local Transit Tax",
    "exm": 0.0,
    "lns": 0,
    "pcd": 2604100,
    "rate": 0.00375,
    "sur": false,
    "tax": 0.00038767,
    "lvl": 3,
    "tid": 314
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.10337817,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "NY Sales Tax",
    "exm": 0.0,
    "lns": 0,
    "pcd": 2604100,
    "rate": 0.045,
    "sur": false,
    "tax": 0.00465202,
    "lvl": 3,
    "tid": 313
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.10337817,
    "calc": 1,
    "cat": "SALES AND USE TAXES",
    "cid": 1,
    "name": "NY Sales Tax",
    "exm": 0.0,
    "lns": 0,
    "pcd": 2604100,
    "rate": 0.04,
    "sur": false,
    "tax": 0.00413513,
    "lvl": 1,
    "tid": 313
},
{
    "max": 2147483647.0,
    "min": 0.0,
    "tchg": 0.10337817,
    "calc": 1,
    "cat": "EXCISE TAXES",
    "cid": 4,
    "name": "Excise Tax",
    "exm": 0.0,
    "lns": 0,
    "pcd": 2502500,
    "rate": 0.025,
    "sur": false,
    "tax": 0.00258445,
    "lvl": 1,
    "tid": 5
}    ],    "incrf": {
"acct": "CertCompany",
"custref": "CertTest1A",
"invn": "CertTest1A",
"bcyc": "202204"    }}
    ]
}
```