If one who is fasting belches out something and it comes into the mouth, if he swallows it again, it will invalidate his fast no matter how little it is and he has to make up for it and also make kaffarah (either fast 60 days or feed 60 poor people the way mentioned in related books). Also, if what he has swallowed is something that is haram to eat (when not fasting), such as blood, he will have to do kaffarah jam’ (meaning that he has to both fast 60 days and feed 60 poor people). All if this is if he swallowed it intentionally. None of what was mentioned applies if it was unintentional though and the fast is valid.
 Tawdihul-Masa’el (annotated by Imam Khomeini), vol. 1, pg. 933.
This question does not have a detailed answer