Fare specification

Proto Definition

// Represents a fare with a breakdown of the different amounts that compose its
// total price.
message Fare {
  // Message to represent a fare breakdown.
  message LineItem {
    // The line item type is used to provide a breakdown of the fare for display
    // to the user. If additional line item types are required please reach out
    // to the Google Transport team.
    enum LineItemType {
      BASE_FARE = 1;
      SERVICE_CHARGE = 2;
      TAXES = 3;
    }

    LineItemType line_item_type = 1;
    .google.type.Money amount = 2;
  }

  // Total amount of the fare. This is equal to the sum of all the line items.
  .google.type.Money total_amount = 1;

  // Details about the different parts that constitute the total amount. The
  // sum of all the line items must be equal to total_amount.
  repeated LineItem line_items = 2;
}

JSON Sample

{
  "total_amount": {
    "units": 2,
    "nanos": 0,
    "currency_code": "USD"
  },
  "line_items": [
    {
      "line_item_type": "BASE_FARE",
      "amount": {
        "units": 1,
        "nanos": 950000000,
        "currency_code": "USD"
      }
    },
    {
      "line_item_type": "SERVICE_CHARGE",
      "amount": {
        "units": 0,
        "nanos": 50000000,
        "currency_code": "USD"
      }
    }
  ]
}