Spending on the child's maintenance is obligatory for his father, and is not waived in the event of the mother's wilful disobedience (nushooz) or divorce. If the child is in the mother's custody, then the maintenance should be given to her.
Similarly if the mother with custody asks for a fee for breastfeeding a child, it should be given to her, because Allaah says (interpretation of the meaning):
“Then if they give suck to the children for you, give them their due payment, and let each of you accept the advice of the other in a just way”
See al-Mughni (11/411, 432)
Maintenance includes: food, clothing and other expenses that the child needs such as education. Attention must be paid to the father’s situation, whether he is rich or poor, because Allaah says (interpretation of the meaning):
“Let the rich man spend according to his means; and the man whose resources are restricted, let him spend according to what Allaah has given him. Allaah puts no burden on any person beyond what He has given him. Allaah will grant after hardship, ease”
The scholars differed concerning the small child who is in his mother's custody: does the obligatory spending on his maintenance include accommodation or not? Some scholars were of the view that the father is obliged to spend on his child’s accommodation, because accommodation is essential for him.
Other scholars were of the view that he does not need accommodation and his mother's accommodation is sufficient, because he is in her custody.
Ibn ‘Aabideen (may Allaah have mercy on him) favoured a middle view between these two, which is a good view, namely that it is obligatory to pay for accommodation for the child if the mother has no accommodation, but if the mother does have accommodation, then the father does not have to pay for accommodation for him. He said: The point is that what matters is accommodation for the child, but this applies only if the mother does not have accommodation. But if she does have accommodation and she can have custody of the child there and he can live with her, then (the father is not obliged to pay for it), because there is no need for it. And... It is quite obvious that this is the kindest to both parties, so this is what they should act upon. End quote.
Haashiyat Ibn ‘Aabideen (2/562).
As there is a difference of opinion among the scholars concerning this issue, then the matter should be referred to the judge, who may judge as he sees fit, and both parties must submit to that.
And Allaah knows best.