Inferring the postal code from coordinates can be done by searching the closest postal code out of geolocalized postal data. However, you can be more accurate by using postal boundaries, because postal codes cover areas which vary in shape and size.
That is illustrated on the figure, where the blue pentagon highlights the area for which the 19070 zip centroid is the closest. That pentagon is significantly different from the red polygon, showing the actual area covered by that zip code.
Extracting the closest zip centroid will not always point to the correct zip. For instance, you will get an accuracy of only 55% in the USA. If you're aiming for higher accuracy, postal boundaries data is the solution.