Amount and Distance Return 0 When Restricting Key
-
Trying to setup the plugin. Everything seems to work smoothly when using an unrestricted key. The map updates properly, the distance and fees are calculated, checkout total updated as well.
The moment I restrict my key using my domain, the JS no longer calculates the fees or distance. The JSON returns 0 for both.
I had unrestricted APIs but also tried restricting these APIs only:
- Directions API
- Distance Matrix API
- Geocoding API
- Geolocation API
- Maps JavaScript API
- Places API
There are still issues calculating fees or distance, it does not seem to be related to APIs restrictions. When I restrict the key itself using website restriction, like so
- *.domain.com/*
- https://domain.com/*
- https://domain.com/checkout
The map itself is still initialized with domain restrictions (which means the domain is recognized). We can see delivery point A to point B once the calculation function is called. The response that includes fees and distance calculations does not work. There are no console log errors or warnings.
I’ve added a response console log in the
resp.success
function, but it returns objectstotal_amount: 0
,total_dist: 0
. Any idea why?Currently, I’m running the plugin with an unrestricted domain key but I’d like to have a solution that works with a restricted domain.
Cheers, and thanks for this plugin!
- You must be logged in to reply to this topic.