All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad is His slave and Messenger. We ask Allaah to exalt his mention as well as that of his family and all his companions.
In principle a husband should avoid foreplay with his wife while fasting. It is forbidden for him to have sexual intercourse with her and he should not engage in foreplay or the like with her, as that could lead to sexual intercourse and consequently to voiding his fast. Therefore, you should not have done what you did and you should avoid that in the future. The Muslim jurists differed regarding a person who indulged in foreplay with his wife and a white discharge came out of his sexual organ when having a desire for sexual intercourse. The most preponderant opinion of the scholars however, is that his/her fast is valid. Based on this opinion, your fast and the fast of your wife is correct but it would be more appropriate if each of you makes up for this day to avoid the difference of opinion of the scholars who say that the fasting in such case is invalid.
Finally, it should be noted that whoever was engaged in foreplay with his wife and ejaculated, his fasting is void and some scholars stated that there is a consensus about this.
Allaah knows best.