tolu360 / react-native-google-places

iOS/Android Google Places Widgets (Autocomplete Modals) and API Services for React Native Apps
567 stars 289 forks source link

[IOS] priceLevel is returned even if not selected in placeFields - possible billing concern #287

Open chrislarson opened 4 years ago

chrislarson commented 4 years ago

Thank you for the excellent library @tolu360! I'm wondering if this is a possible issue, or if I am doing something incorrectly. Please note that I did have to patch to Places and Maps 3.5.0 before installing for compatibility with react-native-maps.

priceLevel is considered Atmospheric Data by Google, which is billed as a separate SKU, and is very expensive to query. I am seeing priceLevel returned on iOS even if it is not part of the selected fields.

Sample code:

RNGooglePlaces.openAutocompleteModal({}, ['name', 'placeID', 'location', 'viewport'])
      .then((place) => {
        console.log(place);
      })
      .catch((error) => console.log(error.message)); 

Sample response (iOS):

{ 
  priceLevel: -1, 
  placeID: "ChIJeZZK0S93j4AROMShF38vsEQ", 
  viewport: {…}, 
  location: {…}, 
  name: "Pacifica"
}
chrislarson commented 4 years ago

I could be mistaken here. Is (-1) a default value always returned for priceLevel on iOS if it is not part of the original query?

tolu360 commented 4 years ago

Without checking the docs for confirmation, I would go out on a limb to say that may be the default on iOS when it is not included in the selected fields - however, let me confirm and get back to this later.