This document will set the google API keys for the plugin. Please follow all three steps.
1. Enable billing
Some Google APIs charge for usage, and you need to enable billing before starting using these APIs.
To enable billing for your project:
- Go to the API Console.
- From the projects list, select a project or create a new one.
- Open the console left side menu and select Billing.
- Click Enable billing. (If billing is already enabled, then this option isn’t available.)
- If you don’t have a billing account, create one.
- Select your location, fill out the form, click Submit and enable billing.
2. Enable API’s
To enable an API for your project:
- Go to the API Console.
- From the projects list, select a project or create a new one.
- If the APIs & services page isn’t already open, open the console left side menu, select APIs & services, and select Library.
- Click the API you want to enable. If you need help finding the API, use the search field.
- Click ENABLE.
Please enable the following APIS:
3. Create API keys
You will create two different API Keys.
You will use the first key for the website and the second one for the server.
Create a key for website Application restrictions.
- Go to the Google Cloud Platform Console.
- On the left menu, click on Credentials.
- Click on the Create Credentials button at the top of the page and select API Key.
- The new pop-up window will show up with your new key. Click restrict key.
- On the key settings page, you can call the key as website key.
- On the Application restrictions section, choose HTTP referrers (web sites).
- A Website restrictions section will show up. Click Add an item.
- Write your domain as follows *.example.com/* and click done.
Notice: If the map is not showing, you can add one of the following domains and recheck the map. example.com/*
http://example.com/*
https://example.com/*
- On the API restrictions section, you can choose none or If you want to enable APIs click Restrict key and select the following APIs:
Directions API
Maps Embed API
Maps JavaScript API
Geocoding API. - Click the Save button.
- Copy the key and go to the plugin settings and set the key on the Key for Maps Embed API and Maps JavaScript API. ( Application restrictions: HTTP referrers ) input.
Create a key for Server Application restrictions.
- Go to the Google Cloud Platform Console.
- On the left menu, click on Credentials.
- Click on the Create Credentials button at the top of the page and select API Key.
- The new pop-up window will show up with your new key. Click restrict key.
- On the key settings page, you can call the key as website key.
- On the Application restrictions section choose IP addresses (web servers, cron jobs, etc.).
- Accept requests from these server IP addresses section will show up, click Add an item.
- Write your server IP address and click done.
- On the API restrictions section, you can choose none or If you want to enable APIs, click Restrict key and select the following APIs:
Directions API
Distance Matrix API
Geocoding API. - Click the Save button.
- Copy the key, go to the plugin settings, and set the key for Maps Directions API and Distance Matrix API. ( Application restrictions: IP addresses ) input.
You are Done!