I posted about this issue back in Feb/March 2014 that my battery was shutting down at 15-20% and it was happening to a lot of other people, there is a thread about it here on the forum. I knew this was a defective battery as it should not be shutting down without warning.
I got my phone in Nov 2012 and my battery started doing this about 15 months later. I took it to the Apple store and they hooked it up and showed it needed to be replaced but I had to pay $79.00 plus tax, she put in all my notes that phone was shutting down without warning at 15-20% but I still had to pay. Since getting the new battery it's been perfect, no issues.
Thanks MacRumors for this article.
Even though my serial # said it wasn't in the range, it also said that it showed I had my battery replaced and that I may be eligible for a refund, so I called Apple and they opened a case, I spent 30 mins and uploaded my Apple receipt showing I paid $79.00 for a new battery (thank goodness I keep receipts) I was in the range of purchasing my iPhone 5 between those dates affected so Apple said I should expect a refund in several weeks, he said I am eligible for refund.
This is why Apple customer service is rated so high, it may take them awhile but they always make good on their products. This is why I love Apple.