GoogleMaps API KEY for testing [closed]
Asked Answered
N

3

49

I'd like to add an API_KEY for GoogleMaps for testing and in documentation I've read this :

Tip: During development and testing, you can register a project for testing purposes in the Google Cloud Platform Console and use a generic, unrestricted API key. When you are ready to move your app into production, register a separate project for production, create an Android-restricted API key, and add the key to your application.

My question is, do I have to put my Credit card even if it's a testing API_KEY? I do not get the purpose to put my Creadit card to use Google Maps, isn't it free?

Nunes answered 9/9, 2018 at 21:4 Comment(2)
See: developers.google.com/maps/billing/… Note that the change was recent so other documentation may not have been updated.Keciakeck
@Divyanshu can you PLS add Custom Search API to your api key project ^^Lynd
H
35

Updated Answer

As of June11, 2018 it is now mandatory to have a billing account to get API key. You can still make keyless calls to the Maps JavaScript API and Street View Static API which will return low-resolution maps that can be used for development. Enabling billing still gives you $200 free credit monthly for your projects.

This answer is no longer valid

As long as you're using a testing API key it is free to register and use. But when you move your app to commercial level you have to pay for it. When you enable billing, google gives you $200 credit free each month that means if your app's map usage is low you can still use it for free even after the billing enabled, if it exceeds the credit limit now you have to pay for it.

Hetaera answered 9/9, 2018 at 21:15 Comment(12)
But how do I get the free API_KEY? When I'm trying to get it I need to put my credit card numberBroz
Try this link. Go to developers console create a new project.Hetaera
Yes, but how do I get the APIKEY? I enabled itBroz
Select Maps SDK for android, Enable API, choose your project. Once it is enabled. Go to navigation menu, api and services and select credentials. There you will find your key.Hetaera
Do I have to add restrictions aswell? I just selected API RESTRICTIONS and selected Maps, is it ok?Broz
You can just leave them for now. And start using the API in your app. If this solved your problem mark the answer accepted.Hetaera
Let us continue this discussion in chat.Broz
It now shows an error, where you are asked to Enable Billing for Places API.Toluene
@DenysFiialko So you are getting an error when you are enabling billing for your account?Hetaera
It seems to me that there is no longer a testing API key. At least I can't generate one, I can just generate normal keys. Also, if oyu use google mpas without key, it seems to work for development purposesAlcove
@Alcove as mentioned, test keys are no longer valid, keyless calls are the way to go for developmentHetaera
Be aware that the development API Key has exactly the same permissions/quota than a production one, and adding IP/domain restrictions might be difficult so don't forget to delete them after usageCleopatracleopatre
E
44

There seems no way to have google maps api key free without credit card. To test the functionality of google map you can use it while leaving the api key field "EMPTY". It will show a message saying "For Development Purpose Only". And that way you can test google map functionality without putting billing information for google map api key.

<script src="https://maps.googleapis.com/maps/api/js?key=&callback=initMap" async defer></script>
Etienne answered 19/5, 2019 at 17:21 Comment(2)
Unfortunately, it's not working. I am geting this error. You must use an API key to authenticate each request to Google Maps Platform APIs. For additional information, please refer to g.co/dev/maps-no-accountDepolymerize
This answer is no longer valid unfortunately. You must send a keyUllman
H
35

Updated Answer

As of June11, 2018 it is now mandatory to have a billing account to get API key. You can still make keyless calls to the Maps JavaScript API and Street View Static API which will return low-resolution maps that can be used for development. Enabling billing still gives you $200 free credit monthly for your projects.

This answer is no longer valid

As long as you're using a testing API key it is free to register and use. But when you move your app to commercial level you have to pay for it. When you enable billing, google gives you $200 credit free each month that means if your app's map usage is low you can still use it for free even after the billing enabled, if it exceeds the credit limit now you have to pay for it.

Hetaera answered 9/9, 2018 at 21:15 Comment(12)
But how do I get the free API_KEY? When I'm trying to get it I need to put my credit card numberBroz
Try this link. Go to developers console create a new project.Hetaera
Yes, but how do I get the APIKEY? I enabled itBroz
Select Maps SDK for android, Enable API, choose your project. Once it is enabled. Go to navigation menu, api and services and select credentials. There you will find your key.Hetaera
Do I have to add restrictions aswell? I just selected API RESTRICTIONS and selected Maps, is it ok?Broz
You can just leave them for now. And start using the API in your app. If this solved your problem mark the answer accepted.Hetaera
Let us continue this discussion in chat.Broz
It now shows an error, where you are asked to Enable Billing for Places API.Toluene
@DenysFiialko So you are getting an error when you are enabling billing for your account?Hetaera
It seems to me that there is no longer a testing API key. At least I can't generate one, I can just generate normal keys. Also, if oyu use google mpas without key, it seems to work for development purposesAlcove
@Alcove as mentioned, test keys are no longer valid, keyless calls are the way to go for developmentHetaera
Be aware that the development API Key has exactly the same permissions/quota than a production one, and adding IP/domain restrictions might be difficult so don't forget to delete them after usageCleopatracleopatre
N
9

You can test it: It will show a message saying "For Development Purpose Only". And that way you can test Google Maps functionality without putting billing information for the Google Maps API key.

<script src="https://maps.googleapis.com/maps/api/js?sensor=false&callback=myMap"></script>
Nata answered 28/2, 2021 at 19:23 Comment(1)
On my end, this trick does not work anymore (since a couple of months).Pyrethrin

© 2022 - 2024 — McMap. All rights reserved.