On my fast of Mahe Ramzan, I got some mucus between my nose and my throat. My plan was to pull it through my throat and swallow it without letting it into my mouth. But afterwards, somehow , I cough while swallowing it and it came into my mouth(not totally, but some part of the liquid). Then I tried to spit it. When i spat, i.felt like it was in my throat still and not in my mouth. So i continued my plan of swallowing it. But when i swalloed some saliva, i felt like half of the liquid was in my mouths beginning, which(the liquid) was sticked with the other part of it, which was in my throat. But i felt this after i swallowed it. So is my fast invalid and do i need to.pay kaffarah and kaza or something? or is my fast valid?

Your fast is valid and no need to pray back