Toll

Example 3 – Discounted tolls through automatic payment

Some toll plazas offer a percentage discount for users who use automatic payment methods, known as TAG or TelePeaje.

In Brazil, this percentage is 5% off and is available to only a few dealerships that offer the service. This percentage may vary in other countries. In Argentina, for example, the Caminos del Río Uruguay dealership offers a 15% discount to users who use the tag, or TelePeaje.

In the following example, we have a route using a single-axle truck that passes through the Parapuã toll, in Brazil, which offers a 5% discount.

{
    "calculationMode": "THE_FASTEST",
    "points": [
        {
            "siteId": "p1-before829",
            "latitude": -21.839539778137308,
            "longitude": -50.72464998254153
        },
        {
            "siteId": "p2-afterid829",
            "latitude": -21.845671861785434,
            "longitude": -50.717879778340304
        }
    ],
    "toll": {
        "vehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES"
    }    
}

As in the previous examples, tollCosts shows the total value of tolls on the entire route. In each leg an object tollCalculation will be returned containing an object tolls with the values and information of each toll on the corresponding stretch, and legTotalCost which shows the total value of tolls on that stretch. The field vehicleType will also be returned, indicating the vehicle used on that stretch.

Inside each object at tolls we will have the information for each toll. With the following differences:

  • price – Normal toll, without the TAG discount;
  • conditions – Array with all the toll’s conditional values. In the case of this example, we have the following information:
    • billingsType – Type of toll collection. Possible values: [NORMAL, TAG];
    • value – Value of the toll in local currency.

In the case of this example, the value that must be taken into account to obtain the TAG discount will be the value of value on conditions, and not the one returned in price.

Here’s the full response to the example:

{
    "id": "6580831a4d0aa15a056e8f30",
    "clientId": "maplink",
    "totalDistance": 989,
    "totalNominalDuration": 44,
    "averageSpeed": 80.00,
    "tollCosts": 20.00,
    "legs": [
        {
            "distance": 988,
            "nominalDuration": 44,
            "averageSpeed": 80.0,
            "points": "vohdCvcrtHbA{AnEwGhCmDfBgCrCsEz@cApAsA~BkBrBiArD}B",
            "tollCalculation": {
                "tolls": [
                    {
                        "id": "829",
                        "name": "Pedágio - Parapuã",
                        "address": "SP294, KM551+500",
                        "city": "Parapuã",
                        "state": {
                            "name": "São Paulo",
                            "code": "SP"
                        },
                        "country": "Brasil",
                        "concession": "Eixo-SP",
                        "direction": "EAST",
                        "coordinates": {
                            "latitude": -21.841946,
                            "longitude": -50.721171
                        },
                        "serviceTypes": [
                            {
                                "serviceId": "792",
                                "name": "Via Facil"
                            },
                            {
                                "serviceId": "35352945515000103",
                                "name": "ANTTCODE"
                            }
                        ],
                        "price": 20.00,
                        "conditions": [
                            {
                                "billingsType": [
                                    "TAG"
                                ],
                                "value": 19.00
                            }
                        ]
                    }
                ],
                "legTotalCost": 20.00,
                "vehicleType": "TRUCK_WITH_TWO_DOUBLE_AXLES"
            }
        }
    ],
    "source": "MAPLINK"
}