shadcn-address-autocomplete icon indicating copy to clipboard operation
shadcn-address-autocomplete copied to clipboard

Improvement: Implement sessionToken for Places API cost reduction

Open monecchi opened this issue 5 months ago • 0 comments

Hi there! I've successfully integrated shadcn-address-autocomplete on my project, so thanks for creating it!

However, I've noticed requests to Google Places API grows really quickly! As Google Places API is a paid service, accounts under the monthly free quota would spend it really fast. I've made around 10 different searches and it summed up to about 226 requests to the API.

By reading the Google Places API (new) docs, I've came accross the sessionToken section. I'm not quite sure if I got it right, but it seems to be used as a strategy for reducing costs while calling the API.

Here's other reference about a similar issue: https://github.com/wellyshen/use-places-autocomplete/issues/137

I'll try to manage it somehow, and in case I succeed, I come here to share the final result.

monecchi avatar Sep 03 '24 03:09 monecchi