Your betta is suffering from a problem with it's swim bladder. The swim bladder is the organ a fish has that regulates its buoyancy.
The fish is also suffering from constipation and bloat.
What I recommend be done to treat this is;
1) Change 50% of the water in the tank.
2) Add 1 teaspoon of epsom salt per every 5 gallons of water. The puprose of the salt is to help draw out the excess fluid the fish is retaining.
3) Continue to feed the pea diet but only feed the fish peas nothing else. Feed 1/2 of 1 canned pea once a day. Make sure to take off the husk/shell of the pea.
4) Verify that the water temperature is at the correct level for bettas which is 80f degrees. If not then slowly adjust it.
5) Begin to treat the fish with a medicine called Maracyn-Two which can be found at most major pet stores.
Please keep in mind that a bettas life span is around 2 years. They are generally put up for sale when they are 1 year old so if you've had the betta for around a year
or more it's advanced in age which makes a recovery even more difficult.
Good luck and let me know if you have any questions.