If it truly says it has AppleCare effective on it then it is covered by AppleCare under any owner.
Go to this web site for information about how to request battery service for your iPhone: iPhone Battery Repair & Replacement - Apple Support
For cost and availability, enter your model information in the "Get an estimate" box at the bottom. (I will let you do this since the answer will depend upon the country where you are located.)
Uh, you say you bought this online. Before you submit it for repair, I would also check this was done: What to do before you sell, give away, or trade in your iPhone or iPad - Apple Support
For instructions on how to get your iPhone, iPad, or iPod touch ready for service click here --> Get your iPhone, iPad, or iPod touch ready for service - Apple Support