Praise be to Allah.
The questioner is surely aware of the virtue of giving charity and what Allah has prepared for those who are charitable. Allah, may He be exalted, says (interpretation of the meaning):
“Verily, those who give Sadaqaat (i.e. Zakaah and alms), men and women, and lend Allaah a goodly loan, it shall be increased manifold (to their credit), and theirs shall be an honourable good reward (i.e. Paradise)”
“Those who spend their wealth (in Allaah’s Cause) by night and day, in secret and in public, they shall have their reward with their Lord. On them shall be no fear, nor shall they grieve”
There are many verses and hadeeths which speak of the virtue of giving charity; you may see some of them in the answer to question no. 36783.
There is nothing wrong with taking back charity before it is handed over to the poor person or to his deputy, because charity does not become the poor person’s property until it is handed over to him. If it has not been handed over to him then it is still the property of the giver, because Allah, may He be exalted, says (interpretation of the meaning):
“If you disclose your Sadaqaat (almsgiving), it is well; but if you conceal them and give them to the poor, that is better for you”
Shaykh Ibn ‘Uthaymeen (may Allah have mercy on him) said in his commentary: One of the things that we learn from this verse is that charity is not regarded as such until it actually reaches the poor person, because Allah, may He be exalted, says: “and give them to the poor”.
Imam Ahmad (26732) narrated that Umm Kulthoom bint Abi Salamah said: When the Messenger of Allah (blessings and peace of Allah be upon him) married Umm Salamah, he said to her: I had given to the Negus a hullah suit and some ounces of musk, but I think that the Negus has died, and I think that my gift will be returned to me; if it is returned to me, then it is yours…” al-Haafiz said in Fath al-Baari: Its isnaad is hasan.
It says in Daqaa’iq Ooli’l-Nuha (1/468): If a person earmarks something to give in charity or delegates someone to give it, then he decides that he will not give it in charity, it is better for him to go ahead with it, so as to go against his greed and the whisper of the Shaytaan, but he is not obliged to go ahead with it because it does not change possession before it is handed over. End quote.
This is the view of most of the fuqaha’. See al-Mughni, 5/379, 383
But after he has handed it over himself or through his deputy, it is not permissible for him to take it back according to the consensus of the scholars (may Allah have mercy on them), because of the report narrated by al-Bukhaari in his Saheeh (2589) from Ibn ‘Abbaas (may Allah be pleased with him), according to which the Prophet (blessings and peace of Allah be upon him) said: “The one who takes back his gift is like the dog that vomits then goes back to its vomit.” According to another version (2623), “the one who takes back his charity.”
Maalik narrated in al-Muwatta’ (1477) that ‘Umar ibn al-Khattab (may Allah be pleased with him) said: “Whoever gives a gift to uphold ties of kinship or by way of charity should not take it back…” Its isnaad was classed as saheeh by Shaykh al-Albaani (may Allah have mercy on him) in Irwa’ al-Ghaleel, 6/55
Al-Bukhaari included a chapter in his Saheeh entitled: It is not permissible for anyone to take back his gift or charity.
Al-Haafiz Ibn Hajar said: … With regard to charity, they are unanimously agreed that it is not permissible to take it back after it has been handed over. End quote from Fath al-Baari.
To sum up: if a person intended to give some money, then it is better for him to go ahead with this act of charity, although that is not obligatory, so long as he has not handed it over to the poor person. If he has handed it over, then it is not permissible to take it back, according to the consensus of the scholars, may Allah have mercy on them.
And Allah knows best.