Chosen Solution

Got this iPhone second hand and every time it gets to 20% it shuts down and says it has no battery but when I plug it in to charge it automatically turns on and says it has 20% please help!

The battery. It needs to be replaced, this is very typical behavior of a bad battery How to replace your iPhone 5 battery iPhone 5 Battery