Google Places Pricing Per Session or Per Request
benneynens opened this issue · 8 comments
I typed a place name 14 characters in length, and within console.cloud.google.com the # of requests increased by 14.
Does this mean that the sessionToken is not working correctly? I'm just playing around using the test project main.dart file.
Any idea if the result of the above is 14 x requests (at $2.83/1000) or 14 x sessions (at $17/1000)
My understanding was that if implemented correctly, you can type unlimited characters in an autocomplete field for one place, and just be charged for a single session (at $17/1000). Ie. 1 session per place, not per character. Not sure if I'm right on that though.
i have same problem
It seems like API is called with every single character you type in. If this is the case it's going to be very expensive :( Can someone from Google team please clarify this issue.
@benneynens As a temporary solution, I am using 'offset' field of PlacesAutocomplete class.
I believe that this library can do this by default but according to Place API docs, we're supposed to handle this: https://developers.google.com/places/web-service/autocomplete
Google recommends the following:
- Use session tokens for all autocomplete sessions.
- Generate a fresh token for each session. Using a version 4 UUID is recommended.
- Ensure that the API key(s) used for all Place Autocomplete and Place Details requests within a session belong to the same Google Cloud Console project.
- Be sure to pass a unique session token for each new session. Using the same token for more than one session will result in each request being billed individually.
Have you guys tried settings the sessionToken
? I haven't tested this myself but the the attribute is there.
Use session tokens
I am having the same issue, any update on this?
@benneynens What you saw is the number of request, not the number of session. If you read the doc carefully, you see:
An Autocomplete session includes some Autocomplete requests (to retrieve suggestions on a place as the user types), and at most one Places Details request (to retrieve details about the place selected by the user).
If I understand correctly, as long as we include a session token, no matter how many requests we make in a session, we will only be charged once.
As for the duration of a session, there is no definitive answer, here's what Google says:
The Autocomplete without Place Details – Per Session SKU is charged for an Autocomplete session that does not include a Place Details request (within a few minutes of the beginning of the session).