The World Federation One Stop Fiqh

Ruling 1574

If, for example, a fasting person indulges in courtship with his wife without the intention of ejaculating, in the event that he is confident (i.e. he has iṭmiʾnān) that he will not ejaculate but does happen to ejaculate, his fast is valid. However, if he is not confident that he will not ejaculate and does ejaculate, his fast is invalid.