It requires a GOOGLE_API_KEY="AIza..."
in your environment variables to run.
A server action is used to fetch the data from Google Places API. If you are not using Next.js, make sure to query the data on the server.
Design inspired by Stripe Checkout.
See the component in action at nomos.checkout.energy (German addresses only).
Speedrun to get a GOOGLE_API_KEY
:
- Go to the Google Cloud Console
- Create a new project (or use an existing one)
- Go to APIs & Services > Credentials
- Create Credentials > API key
- Set Application restrictions to "Websites" and API restrictions to at least having "Places API" enabled
- Go to Google Maps Platform > APIs & Services
- Enable the Places API