Hi,
Assuming that you have already tried a different charger or a different USB cable and connected it to a working PC and your phone still wasn't charging, then the following may be of some help.
Here is a link that shows how to dis-assemble your Lumia 640. At 4:02 minutes into the video the charging port is able to be accessed.
https://www.youtube.com/watch?v=naZRka_VmEI
The USB ports are available on Ebay. Just search for ''USB charging port Nokia Lumia 640''
Here is a link that shows how to replace a USB port on a pcb. This is just a generic replacement as the procedure is the same in most cases.
https://www.youtube.com/watch?v=1xi86kEjK24