Accurate delivery addresses are essential in e-commerce. Without it, we would have a lot of failed deliveries and plenty of unhappy customers. Back in 2016, we used Google Maps API for our geocoding functions. Geocoding is when you take a descriptive address, and sends it to a Geocoding function, which then returns you with a latitude and longitude.
For most applications, you would not hit the maximum thresholds before you start paying for Google Maps API. But as a startup with limited funds, we had to get creative with the limits to save money, while not breaking the terms and conditions for the service.
In Singapore, we have extremely accurate postal codes. Every postal code will give you precise, building level location. So in reality, we only needed to send to Google Maps the following request "Singapore 123456", and we would get a response of the latitude and longitude.
We need the latitude and longitude for us to help our couriers and delivery partners pin the exact location on the map. And that could be any mapping system we want, so long as we pin it with the x,y coordinates.
In order for us to ensure our addresses were correct, we had to look at 2 things, the postal code which would give us the x,y, and then the finer descriptive addresses such as the Floor level and Unit number. For many Singaporeans, this is where addresses can go wrong. We might unwittingly enter the wrong floor or door number. This had happened to me recently when I stupidly mistyped a delivery address to the wrong unit for my new Apple MacBook Pro order. Its rare, but it happens to the best of us.
The first part is easy, the second part, we had to look at our delivery success. So for any given order, we verified the mobile number, which we send a notification to for us to improve the delivery experience. We let the consignee know that we are delivering to the specific address that they used for that order, and they can confirm it if they wish. If there was a mistake, or if they wanted it redirected, they could simply use our microsite to change that.
Once our courier arrives and makes a successful delivery, we capture that success, and deem that the complete address is valid. The next time we receive an order for the same complete address and mobile number, we no longer call the Google Maps Geocoding API. We reference our own database first and fetch the x,y coordinates, to enrich our courier's maps.
This technique saved us thousands in API fees.
Photo by Vladimir Srajber: https://www.pexels.com/photo/map-on-tesla-screen-17345654/