If Apple or an AASP installed the battery, then you have 90 days for them to make things right.
If you replaced the battery with a third party battery, then the replacement battery is likely bad, or the Logic Board was damaged while replacing the battery. The quality of third party Lithium-ion Batteries is extremely poor even when purchased from a reputable vendor such as OWC which is why I will always choose an original Apple OEM battery whenever they are still available. It is hard to say which of these two parts is bad without trying a known good battery, although the battery is usually the weakest link, but it is also easy to damage the Logic Board on this model when removing the battery.