This could be caused by a software or hardware problem. Any way, the fix is to send the phone to a warranty or a service repair shop. If this problem is caused by the software, then it means it needs the OS to be reinstalled again by a phone technician. Alternatively, your charger or battery could have an error. Replace it or use another cable (if it has a micro USB input).