<br />

**European Economic Area (EEA) developers**

> [!NOTE]
> If your billing address is in the European Economic Area, effective on 8 July 2025, the [Google Maps Platform EEA Terms of Service](https://cloud.google.com/terms/maps-platform/eea) will apply to your use of the Services. Functionality varies by region. [Learn more](https://developers.google.com/maps/comms/eea/faq.md.txt).

The Places API can return detailed information about a specific place. This page
explains the differences between place details as used in the `Place` class
(new) and `PlacesService` (legacy), and provides some code snippets for
comparison. The following table lists some of the main differences in the use of
place details between the `Place` class and `PlacesService`:

| [`PlacesService`](https://developers.google.com/maps/documentation/javascript/reference/places-service.md.txt) (Legacy) | [`Place`](https://developers.google.com/maps/documentation/javascript/reference/place.md.txt) (New) |
|---|---|
| [`getDetails()`](https://developers.google.com/maps/documentation/javascript/reference/places-service.md.txt#PlacesService.getDetails) | [`fetchFields()`](https://developers.google.com/maps/documentation/javascript/reference/place.md.txt#Place.fetchFields) |
| [`PlaceDetailsRequest`](https://developers.google.com/maps/documentation/javascript/reference/places-service.md.txt#PlaceDetailsRequest) | [`FetchFieldsRequest`](https://developers.google.com/maps/documentation/javascript/reference/place.md.txt#FetchFieldsRequest) |
| Methods require the use of a callback to handle the results object and `google.maps.places.PlacesServiceStatus` response. | Uses Promises, and works asynchronously. |
| Methods require a `PlacesServiceStatus` check. | No required status check, can use standard error handling. [Learn more](https://developers.google.com/maps/documentation/javascript/reference/errors.md.txt). |
| [Place data fields](https://developers.google.com/maps/documentation/javascript/place-data-fields) are formatted using snake case. | [Place data fields](https://developers.google.com/maps/documentation/javascript/place-class-data-fields.md.txt) are formatted using camel case. |
| Limited to a fixed set of [place types](https://developers.google.com/maps/documentation/javascript/supported_types) and [place data fields](https://developers.google.com/maps/documentation/javascript/place-data-fields). | Provides an expanded selection of regularly updated [place types](https://developers.google.com/maps/documentation/javascript/place-types.md.txt) and [place data fields](https://developers.google.com/maps/documentation/javascript/place-class-data-fields.md.txt). |

## Code comparison

This section compares two similar pieces of code to illustrate the differences
between the Places Service and the
Place class. The code snippets show the code
required on each respective API to make a place details request, and then use
the resulting place data to add a marker to the map.

### Places Service (Legacy)

The following condensed code snippet shows making a place details request using
`PlacesService`. The request uses a callback, and includes a required
conditional check on `PlacesServiceStatus`. The needed place data fields are
specified in the request body.

```javascript
function getPlaceDetails() {
  // Instantiate the Places Service.
  const service = new google.maps.places.PlacesService(map);

  // Make a request using the Place ID.
  const request = {
    placeId: "ChIJN1t_tDeuEmsRUsoyG83frY4",
    fields: ["name", "formatted_address", "place_id", "geometry"],
  };

  // Request place details.
  service.getDetails(request, (place, status) => {
    // Check whether PlacesServiceStatus is OK.
    if (
      status === google.maps.places.PlacesServiceStatus.OK &&
      place &&
      place.geometry &&
      place.geometry.location
    ) {

      // Log the result.
      console.log(place.name);
      console.log(place.formatted_address);

      // Add a marker for the place.
      const marker = new google.maps.Marker({
        map,
        position: place.geometry.location,
        title: place.name,
      });
    }
  });
}
```

#### Learn more

- [See the complete code example](https://developers.google.com/maps/documentation/javascript/examples/place-details.md.txt)
- [Place Details](https://developers.google.com/maps/documentation/javascript/places#place_details) documentation
- [`getDetails` reference](https://developers.google.com/maps/documentation/javascript/reference/places-service.md.txt#PlacesService.getDetails)

### Place class (New)

The following condensed code snippet shows making a place details request using
the `Place` class. The request is asynchronous, and does not include a status
check (standard error handling can be used). A place ID is used to create a new
`Place` instance, which is used to make the request (`fetchFields()`). The
needed place data fields are not passed until `fetchFields()` is called, which
lends greater flexibility. Because the `fetchFields()` method uses the await
operator it can only be used inside an `async` function.

```javascript
async function getPlaceDetails() {
  // Use place ID to create a new Place instance.
  const place = new google.maps.places.Place({
    id: "ChIJN5Nz71W3j4ARhx5bwpTQEGg",
    requestedLanguage: "en", // optional
  });

  // Call fetchFields, passing the needed data fields.
  await place.fetchFields({
    fields: ["displayName", "formattedAddress", "location"],
  });

  // Log the result.
  console.log(place.displayName);
  console.log(place.formattedAddress);

  // Add an Advanced Marker.
  const marker = new google.maps.marker.AdvancedMarkerElement({
    map,
    position: place.location,
    title: place.displayName,
  });
}
```

#### Learn more

- [See the complete code example](https://developers.google.com/maps/documentation/javascript/examples/place-class.md.txt)
- [Place Details](https://developers.google.com/maps/documentation/javascript/place-details.md.txt) documentation
- [`fetchFields()` reference](https://developers.google.com/maps/documentation/javascript/reference/place.md.txt#Place.fetchFields)