You need to enable billing on your Google account - visit https://console.cloud.google.com/project/_/billing/enable to do this.
Jul 8, 2021
6
Level 6
google map api autocomplete not working
I want to add google map api autocomplete to an address input. I followed the documentation and create an API key.
here is my app.blade.php:
<!-- Styles -->
<link href="{{ asset('css/app.css') }}" rel="stylesheet">
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU="crossorigin="anonymous"></script>
<!--Google Map Autocomplete -->
<script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyCGuk0kb5FQ24LflR1C7BtGIE24xaQHfOg&libraries=places"></script>
<style>
.background-img {
background-image: url('images/login_background.png');
background-repeat: no-repeat;
background-size: 100%;
}
.bg-color-navbar {
background-color:#2d2d2d;
}
</style>
</head>
<body>
<!-- Navigation bar -->
@include('layouts.dashboard.navigation-dashboard')
<div id="app">
<!---Side Bar---->
@include('layouts.dashboard.sidebar-dashboard')
<main class="py-4 sidenav-margin-left">
@yield('content')
</main>
</div>
<!-- Optional JavaScript -->
<!-- Popper.js first, then CoreUI JS -->
<script src="https://unpkg.com/@popperjs/core@2"></script>
<script src="https://unpkg.com/@coreui/coreui/dist/js/coreui.min.js"></script>
<script type="text/javascript">
google.maps.event.addDomListener(window, 'load', function () {
var places = new google.maps.places.Autocomplete(document.getElementById('customerAddress'));
google.maps.event.addListener(places, 'place_changed', function () {
});
});
</script>
</body>
</html>
The autocomplete did not show up when I write something on it. I check the dev tools and it seems to mention:
Places API error: BillingNotEnabledMapError
Is there anything wrong with my code?
I do not want to create billing as it requires credit card info.
Or did i miss out anything?
Please or to participate in this conversation.