If it stopped charging and the problem is from the battery the laptop will give you a notification that the battery expired this happened to me , if this happened you can change the battery or better send it to laptop specialist to check it if the problem from the battery or something else.
Battery have a life time so it need to be changed from time to time , for me it worked six years and now it expired.
If you don't want to buy a new battery you can use it connecting it to the plug.
Also the life time of the battery depend on the quality of the laptop you bought.
As for me I bought once dell and I got cheated from the shop and the battery stopped working after 2 months.
And what I discovered is that the seller was using it long time ago and renew it and cheated me and sold me it as a new laptop and charge me a lot of money.
The second laptop I bought is hp and the battery last 6 years from a trusted computer shop.
If your laptop is new go to the shop you bought it from and let them check it for you.
Also check the battery if it is connected good to the laptop maybe it moved a little bit when you transfer your laptop from one place to another.
Remove the battery and put it back and check again.