Question: It is very often asked about someone who intended: “If Allah heals my sick relative, I will fast three days,” or something similar. Is that binding?
Answer:
1. If he said: “I intended with fasting … etc.,” then what he mentioned is not binding upon him.
2. But if he said: “I intended for Allah with fasting … etc.,” then he is bound to fulfill what he mentioned of fasting or charity.
We only said that he is bound to fulfill (it) in this second case because the word niyyah (intention) is used among them with the meaning of obligating and binding it upon oneself; so its meaning with them is: “I have made it obligatory upon myself, for Allah, to …” and so on; and the well-known technical meaning of niyyah is not what is meant here.
And we said that it is not binding in the first case because he did not mention the word “Allah,” and the Imams, such as Zayd ibn ʿAlī (Peace be upon him), have stipulated that (the name of) Allah be mentioned. However, he ought to fulfill what he mentioned and not be negligent about it, for perhaps the healing of his sick relative was on account of that means.
Source: Min Thimār al-ʿIlm wa al-Ḥikmah vol.2