1. Home
  2. Docs
  3. Distance Rate Shipping for WooCommerce
  4. Getting Started
  5. How to generate and set the Google Distance Matrix API key?

How to generate and set the Google Distance Matrix API key?

This document will set the google API key for the plugin. Please follow all steps.

1. Enable billing

To enable billing for your project:

  1. Go to the API Console.
  2. From the projects list, select a project or create a new one.
  3. Open the console left side menu and select Billing.
  4. Click Enable billing. (If billing is already enabled, then this option isn’t available.)
  5. If you don’t have a billing account, create one.
  6. Select your location, fill out the form, click Submit and enable billing.

2. Enable API’s

To enable an API for your project:

  1. Go to the API Console.
  2. From the projects list, select a project or create a new one.
  3. If the APIs & services page isn’t already open, open the console left side menu, select APIs & services, and select Library.
  4. Click the API you want to enable. If you need help finding the API, use the search field.
  5. Click ENABLE.

Please enable the following API:

3. 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 API:
    Distance Matrix API
  • Click the Save button.
  • Copy the key, go to the plugin settings, and set the key for Distance Matrix API. ( Application restrictions: IP addresses ) input.

You are Done!