NetTalk Central

Author Topic: Google Places API - potentially billing effected?  (Read 2562 times)

JohanR

  • Sr. Member
  • ****
  • Posts: 375
    • View Profile
    • Email
Google Places API - potentially billing effected?
« on: August 17, 2023, 11:43:15 PM »
Hi,

If anyone else is using Google API, this might affect the billing, still investigating this.
I have implemented Google address and been testing it and currently working on refining and see how to improve the user experience.

To find an address it can consist of several calls to Google Autocomplete, this will return a list of possibles.
If the user picks an address then a call is made to Google PlacesDetails which will then return specific info for that address, including the critical required postal code and plus code.

However I found this in the docs this morning and still looking into it.
If I understand it correctly every call will be billed, unless it's wrapped in a sessiontoken ID, which will result in one billing once a call is made to Google PlacesDetials.

As we have been spoilt, a call to stringhteory seems to generate an ID in the correct format.
str.MakeGuid4()

If anyone else has implemented Google search, would appreciate any feedback, I will look into over the weekend and report back as well.


Johan





https://developers.google.com/maps/documentation/places/web-service/autocomplete

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
sessiontoken
A random string which identifies an autocomplete session for billing purposes.

The session begins when the user starts typing a query, and concludes when they select a place and a call to Place Details is made. Each session can have multiple queries, followed by one place selection. The API key(s) used for each request within a session must belong to the same Google Cloud Console project. Once a session has concluded, the token is no longer valid; your app must generate a fresh token for each session. If the sessiontoken parameter is omitted, or if you reuse a session token, the session is charged as if no session token was provided (each request is billed separately).

We recommend the following guidelines:

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 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.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++