Enable Billing on the Google Cloud Project - google-maps

I want to retrieve address from lat long coords. I have created project in google console. Added Billing information and enabled the geocoding api services. But still when i make this request i am getting the below error
https://maps.googleapis.com/maps/api/geocode/json?latlng=41.89,12.49&key=xxxx
You must enable Billing on the Google Cloud Project at https://console.cloud.google.com/project/_/billing/enable

I was also Facing the same issue, Billing is enabled and is linked to the project but I was getting the same Error.
After Spending enough time on this issue, I understood that the type of my billing account is "Google Cloud Platform", but it should be of type : "Google Maps Platform"
You can see the type of your billing account on the right side of Billing Overview as in the image:
So please check if your Billing type is "Google Maps Platform", if not create a new Billing Account with "Google Maps Platform" as type and link your project to this Billing Account.

Most of us are getting this response/error
{
"error_message" : "You must enable Billing on the Google Cloud Project at <br>https://console.cloud.google.com/project/_/billing/enable Learn more at https://developers.google.com/maps/gmp-get-started",
"predictions" : [],
"status" : "REQUEST_DENIED"
}
If you will read this answer throughly you'll be able to sort out this issue.
As mentioned in this answer.
You'd have to create a separate billing account in order to use Google Map APIs because google map bills in USD currency instead of your native currency.
Solution(3 step)
create a new billing account.
create a new project and associate it with above billing.
enable Map API and create a new API key. that's it.
Step1: create a new billing account, you can use this link https://console.cloud.google.com/billing/create and Choose Google Map Platform from the dropdown.
Step2: create a new project using this link https://console.cloud.google.com/projectcreate and use billing account created above.
Step3: Now you can enable particular API and you're good to go. That's it.

Make sure that the API key you are using to authenticate the request is from a project that has an active billing account. If not, your requests will fail and if you are using Javascript API, your map will get the "Degraded experience".
Below are some of the links we have that could be helpful in your use case.
Managing your billing accounts
Modify a project's billing settings
Viewing your cost trends with billing reports
Once everything is set up, you can always file a support case via https://console.cloud.google.com/google/maps-apis/support in order to open personalized communication channel whenever you are encountering issues with our product.
Thank you and hope this helps!

Go back to the billing account and see if something went wrong with your credit card. Credit cards are validated asynchronously.
Go to the GCP Console and verify that your billing account is assigned to the project.
In the GCP Console check for past due amounts.
After you assign/modify a credit card, wait. The process is not instant in (re)authorizing billing for your account.

I had the same issue. I was doing everything correct.
then I found this link
Gmp india faq
The problem was Google maps billing doesn't support INR Currency.
Please check if your currency compatible with Google Maps billing platform otherwise create new billing account with USD currency.
Thanks!
You may find this link helpful
Modify a project billing settings

I have had similar problem, when I have created a free tire payment account and I was not able to create a Windows VM as thesse are paid.
To fix I have "upgraded" the free tier payment account. It was confusing because the payment account has had enabled a valid payment method and linked to the project but it was not working.
There is a button to upgrade the free tier payment account, on the account dashboard page.

For those of you who enabled their billing account through the link in the error message but still get the error, or can't find "Enabled google service" as someone else suggested, simply just delete your browsers cache and try again.

For anyone still struggling , my case was that i have reached a maximum of projects for the same billing account and for some reason i couldnt create a new one as mentioned above , for that after a lot of reasearch i found that i could disable billing for some project so i can use it in new ones :
1- go to the link https://console.cloud.google.com/billing/projects
2- click on the three dots for the first projects (the billing is enbale for those projects).
3-disable one of them
4- enable the billing for your new project and you are good to go !
however still not sure why i could only enable this for just 3 project , i think it is not a lot !

Use:
gcloud alpha billing accounts list --format json
# ^^ find an active billing account then
ACCOUNT_ID='0XYXYX-XYXYXY-XYXYXY'
gcloud beta billing projects link $PROJECTNAME --billing-account $ACCOUNT_ID
# ensure it says "billingEnabled: true"

Related

Google Workspace alert or API to be notified when users are about to reach full storage

I do not see anymore in Google Workspace interface a way to receive alerts when users are about to reach their storage limit (only end users receive alerts). is there any setting I can use to receive this alerts as an Administrator or any API that will let me do that?
I have been reviewing the documentation for alerts and also storage settings in the Admin console. It seems like as Administrator you can only see the list of users and filter out of storage users.
You can view this Help Center for reference.
Unfortunately a setting like that is not available at the moment. It would be a great idea to share the feedback for something like that in the future. If you have a Google Workspace account you should be able to request access to the feature ideas portal and send the feedback
You can give your feedback or request a feature over here:
https://www.googlecloudcommunity.com/gc/Feature-Ideas/cmp-p/grouphub%3Aworkspace-ideas-group
Utilizing API or App script can help you to manually make a call and pull some of the data of the users and their storage, for example:
function getStorage() {
var about = Drive.About.get();
about.quotaBytesByService.forEach(function (s) {console.log(s)});
}
It should give you the usage of Drive Storage in all services that take space. You can also utilize the Reports API, to gather used quota in percentage of the users quota storage using the "used_quota_in_percentage" as suggested by the documentation. You can test it here
You can add the parameter from the screenshot for all users or specific users and try to filter it in case you are looking to implement it in the future:

How to use Google Apps Script setAuthentication?

So, I created an script on google sheets that, basically, selects a set of addresses on a sheet and uses Maps.newGeocoder.geocode() to get geocodes and calculate distances. It works wonderfully, no problems there. However, when I try to authenticate using Maps.setAuthentication(clientId, signingKey);, I just get an error.
I got my credentials from loging into https://console.cloud.google.com/, creating a random project and by going in "Create credentials". When I go into the credentials tab, I can select OAuth2.0 and see clientId and client secret key. I am using these to authenticate. Is it correct? What am I doing wrong? How the hell can I get the credentials? Thanks a lot!
The setAuthentication(clientId, signingKey) method enables the use of an externally established Google Maps APIs Premium Plan account, to leverage additional quota allowances. Your client ID and signing key can be obtained from the Google Enterprise Support Portal.
They are not the same as client ID and client secret key as explained here.
Note that this type of account is not longer available for new customers.
Here some helpful links:
Premium Plan Support
Premium Plan FAQ

Error on google function deploy, service account doesn't exist

Please can you help me, I'm receiving this error when I'm trying to deploy a google cloud function:
HTTP Error: 400, Default service account 'project-name#appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Cloud Functions API), or specify a different account.
The command used to deploy is:
firebase deploy --only functions
A temporary solution is fine, but if you can help me to solve it permanently is better.
Thanks in advance.
In my case, the App Engine default service account was deleted. It looks like this: {project_id}#appspot.gserviceaccount.com
So I had to restore the service account like this:
You can now recover the deleted service accounts from https://cloud.google.com/iam/reference/rest/v1/projects.serviceAccounts/undelete
you have to get the UniqueID of the service account from https://console.cloud.google.com/home/activity
Source: https://stackoverflow.com/a/55277567/888881
The API explorer is an easy way to use the IAM API: https://developers.google.com/apis-explorer/#p/
I was struggling to resolve this issue, then I raised a case with Google.
here is a detailed article of my learnings :
https://medium.com/#ashirazee/http-error-400-default-service-account-appspot-gserviceaccount-com-accd178ea32a
Firstly navigate to Google Cloud Platform and view your service accounts.
try and find <project_id>#appspot.gserviceaccount.com' in your list of service accounts for the firebase project, it is linked to the App Engine.
if '#appspot.gserviceaccount.com' is missing you can not deploy anything(SEE EMAIL WITH GOOGLE BELOW), if it isn't, check and see if it's enabled, try disabling it and enabling it again.
#appspot.gserviceaccount.com is pre-installed by default, regardless of a paid account or not. try and recall if at any time you may have deleted it after or before deployment.
Now if you have for any reason deleted it over a period of more than 30 days than you can not retrieve it, and you must create a new firebase project. However, if it is within 30 days you can undelete it.
EMAIL FROM GOOGLE:
Email #1
"
Hello Ali
I am checking the logs of your project, unfortunately the service account was deleted on Ma, there is no chance to recover it nor recreate it
The only workaround available is to create a new project and deploy the service desired there. I know this could not be the best option for you nevertheless it is the way this works by design.
Do not hesitate to write back if you have more questions.
Cheers,"
Email #2,
"Hello Ali
I am glad to read that you have been able to deploy your functions successfully, unfortunately that service account cannot be recovered after 30 days of being deleted and that is the only solution. If you have other questions, please let us know by contacting us again through our support channel.
Cheers,"
lastly here is a helpful command line that will help you debug this, however, it won't help if there is no service account, it'll just highlight the obvious:
firebase deploy --only functions --debug
this was my error:
"HTTP Error: 400, Default service account '<project_id>#appspot.gserviceaccount.com' doesn't exist. Please recreate this account (for example by disabling and enabling the Clo
ud Functions API), or specify a different account."
Following the error message, you could enable the API by console accessing this url and enable the api.
Or by gcloud command:
gcloud services --project <project_id> enable cloudfunctions.googleapis.com
As the other stated, sadly, you need to use the default service account.
If within the 30 days period, you can use this tutorial to find and undelete the service acc: Read this guide to get https://cloud.google.com/iam/docs/creating-managing-service-accounts#undeleting_a_service_account
You have to enter the commands through the Google Cloud Console (one of the buttons will open a terminal on the right of the top blue app bar)
try to select Google Cloud Platform (GCP) resource location in Setting of Firebase. enter image description here

billing clients for google api's

Questions regarding billing for Google API's or more specifically the places and maps Google API's.
We have an app which is part of a SAAS package. When clients use our Software we have maps and place's API built it, however we want to offset the cost of the bill using these API's to that particular client using the software.
Currently we have a single Google Project we created and enabled the API's on our own google account however this means we will foot the bill as its using our token.
Can clients somehow connect to our google project etc or do we simply need them to create their own google project and pass that token through? Is there a streamlined approach that covers this...
When we did for our multi tenant application we did create only one google project and billing was getting accumulated into a single account. We looked at what you're talked about but since google does not allow to bill separately without having separate google project. Google API billing works on google project id. We decided to bill our clients separately and handled all calls to Places API on a single google project.
Long story short - it was not easy to have our clients connect to our project without having them create their own google project we ended up with one google api project.
edit: also missed another important point - Google My Business API needed whitelisting for each project id so it was another reason to keep it as a single project
Passing the token to the application is a probably very bad idea and will result in a security risk for your client and their token if it is intercepted.
As a developer for the client they should create a token on their account and then they will be charged. They can then give it to you as the developer for use. This is however a gray area as technically you are not allowed to share your tokens with anyone TOC However i believe that client and developer relationship should be secure enough for sharing the token.
Ideally you should give the client the code they can then use their own token and run the application themselves.

Google Cloud Project Blocked, Abuse Detected

After i started my free trial of google cloud usage, just after when i tried to create a VM instance it gave the error that is written in the title. Then i created another project then i get this error for every project i create.
How can i fix this?
The error that is communicated by the “Google Cloud Project Blocked, Abuse Detected” message, can be addressed as follows:
By making use of the email provided for contact with the error.
By contacting the billing team via the dedicated form: “Google Cloud Platform Billing Support”. In case your account has been already suspended, you can submit supporting documents via the “Submit verification documents to reopen your account” page, as needed.
Each one of the above options will lead you to the billing support team. They are ready to help all GCP customers, and able to verify your funding source, confirm its validity, and reinstate normal access to your projects.
If you have multiple projects covered by a unique billing account, any problems with this one account, including blocking, would reflect on all existing projects, and also on eventual future projects opened under the same account.