Hey, I bought two of my newer males from a petstore in a small cup each LIKE SMALL and basically they are just set out until they die in these cups (their water was disgusting)...so I grabbed two and saved them. They were in a similar fashion to your betta, trouble breathing and lying at the bottom...BUT they are both alive and swimming lots today...I will tell you what I did maybe this will help for you.
First thing I did was acclimate them to the water, once I seen their state I lowered the water level so that they could easily access the top of the water. I then fasted them for about two days, because mine had swollen bellies. I would do frequent water changes at this time acclimating them each time because I did not want to stress them (I didn't acclimate them for as long as when they first came home, just a few minutes). After two days I fed them dried blood worms (only a tiny bit each day). One of mine took only 3 or 4 days to be able to hold himself upright properly, so I increased the water level. The other (I thought would not make it) took almost two weeks and would not eat, but I was determined and kept with it..and he pulled though.
If you bought yours in a similar fashion they could have been water with toxic levels of nitrates or ammonia or other substances. They just need time for their bodies to recuperate.
I hope this helps you out and that your fish pulls through! Just keep a close eye on him :) I am rooting for ya!