I was using Google Directions Api within the limit of 2500 route queries per day which is free. It was working fine. Now out of nowhere it gives this error while requesting the api when it is clearly written in https://developers.google.com/maps/documentation/directions/start that Client Id is for premium plan.
Downloaded URL: { "error_message" : "You must enable Billing on the Google Cloud Projectassociated to this client ID, at https://console.cloud.google.com/project/_/billing/enable.Learn more at https://developers.google.com/maps/premium/new-plan-migration", "routes" : [], "status" : "REQUEST_DENIED"} Background task data { "error_message" : "You must enable Billing on the Google Cloud Projectassociated to this client ID, at https://console.cloud.google.com/project/_/billing/enable.Learn more at https://developers.google.com/maps/premium/new-plan-migration", "routes" : [], "status" : "REQUEST_DENIED"}
How can I solve this issue
From the google maps documentation:
Reminder: To use the Directions API, you must include an API key with all API requests and you must enable billing on each of your projects.
I know they used to allow using the API without a key or billing enabled but they changed their policy a while back.
If you are willing to use an alternative to google maps you can look into OSRM (Open Source Routing Machine), this is completely free but requires some setup and you have to host it yourself. We use OSRM for directions and get much better performance hosting it ourselves for a fraction of the cost of googlemaps.