• Generating Google Maps API Key and Map ID

    Posted by TWS on مارس 17, 2025 at 2:48 ص

    This guide will walk you through the process of generating a Google Maps API key with specific APIs enabled and domain restrictions. Additionally, you will create a Map ID in the Google Cloud Console. This is necessary for the proper operation of the Moasala Taxi Booking System.

    Usage Limits

    Google Maps APIs come with a free monthly usage limit, which covers most standard use cases. If your usage exceeds this limit, additional charges may apply. You can review the latest pricing details on the Google Maps Platform Pricing Page. To keep track of your usage, you can set up billing alerts in the Google Cloud Console, ensuring you stay within your budget and receive notifications when approaching the free tier limits.

    Important!

    Never reveal your Google Maps API key and limit its use to your domain to avoid additional operational costs.

    Create a Google Cloud Project

    1. Go to Google Cloud Console (if you
      are not logged in, Google will prompt you to log in).
    2. Click on
      the “Select a project”
      dropdown at the top.
    3. Click “New Project.”
    4. Enter a
      project name.
    5. Click “Create.”

    Enable Required APIs

    1. In the
      Google Cloud Console, go to “APIs
      & Services”
      -> “Library.”
    2. Use the
      search bar to find and enable the following APIs:
      • Geocoding API
      • Maps JavaScript API
      • Places API (New)
      • Routes API
    3. Click on
      each API and then click “Enable.”
    4. After
      enabling the first API, Google will prompt you to create a Billing Account
      if one has not been set up.
    5. Choose a
      billing account name and select the currency.
    6. In the
      next step, select a billing profile and payment method (e.g., a card
      linked to your account).
    7. Google
      will attempt to verify your account and will charge 0.00 for verification.

    Important Update as of March 12, 2025!

    Due to recent changes made by Google, you now need to enable both the “Places API (New)” and the legacy “Places API” in your Google Cloud Console. This is necessary to fix the “Places API error: ApiNotActivatedMapError.” You can enable the Places API (Legacy) through this direct link.

    Create an API Key

    1. Navigate
      to “APIs & Services”
      -> “Credentials.”
    2. Click “Create Credentials” and select “API Key.”
    3. Your new
      API key will be generated. Copy it for later use.

    Restrict the API Key

    1. In the “Credentials” section, locate your
      newly created API key.
    2. Click on
      the key name to edit it.
    3. Under “Application restrictions,” select “Websites,” and click “Add.”
    4. In the “Website” field, add your domain(s),
      such as:
      • https://yourdomain.com/*
      • https://sub.yourdomain.com/*
    5. Under “API restrictions,” select “Restrict key.”
    6. From the
      dropdown, check the following APIs:
      • Geocoding
        API
      • Maps
        JavaScript API
      • Places
        API (New)
      • Places
        API
      • Routes
        API
    7. Click “Save.”

    Create a Map ID

    1. Navigate
      to “Google Maps Platform”
      -> “Map Management.”
    2. Click “Create Map ID.”
    3. Enter a
      name for the Map ID.
    4. Select the
      map type: JavaScript
      or Raster.
    5. Click “Save.”
    6. Your Map
      ID will be generated. Copy it for later use.

    Integrating the API Key with Moasala Booking System

    Important Notes

    After generating your API key, please note that it may take 15–20 minutes for the key to become active. During this time, the key will not yet function correctly. Ensure that you wait for the activation process to complete before proceeding with integrating the key into the Moasala Booking System.

    1. Navigate
      to “Settings” ->
      “Moasala Booking System”
      in your WordPress dashboard.
    2. Go to the “General” -> “Google Maps” tab.
    3. Paste your
      Google Maps API Key into the “Google
      Maps API Key”
      field.
    4. Paste your
      Map ID into the “Google
      Maps ID”
      field.
    5. Click the “Save Changes” button to apply the
      settings.
    TWS replied 1 year, 2 months ago 1 Member · 0 Replies
  • 0 Replies

Sorry, there were no replies found.

Log in to reply.