In the name of Allah, the Merciful, the Compassionate!
Surely Allah knows whatever you may have spent
and whatever vow you may have made,and the wrong-doers
(who spend in the way of Satan) shall have no helpers.*1"
"If you practise charity publicly, it is good;
but if you give charity secretly to the needy,
it is much better for you,*2 for this will expiate
many of your sins.*3 Any how, Allah is well aware of
whatever you do."
(Surah-2 Al-Baqarah ~ Ayah-270-271)
Explanation:
*1- Whether or not a man spends in the way of Allah, and
whether or not he vows to spend in the way of Allah,
Allah is fully aware both of his intentions and deeds.
All those who either spend for the sake of Allah or
vow to spend for the sake of Allah will be adequately rewarded.
As for those who have either spent or have vowed to spend for
others than Allah, no one will save them from Allah's chastisement.
'Vow' means either a man's pledge to spend something or
to perform some act of goodness which is not obligatory
on him providing a particular wish of his is fulfilled.
Provided that this vow is related to some wish which is in
itself permissible and good and that the person concerned
makes it to none but Allah and for the sake of Allah, then
such a vow will be reckoned as an act of obedience to Allah
and its fulfillment will be worthy of reward. Otherwise such
a vow will be seen as an act of disobedience and sin and its
fulfillment will invite punishment from Allah.
*2- If charity is of an obligatory nature it is preferable to
dispense it openly. Non-obligatory charity should preferably
be dispensed secretly. This principle applies to all acts.
As a rule, it is more meritorious to perform obligatory acts
openly and non-obligatory acts of goodness, secretly.
*3- The performance of good deeds in secret leads to
the continual improvement of one's life and character.
One's good qualities develop fully and one's bad qualities
gradually wither away. This makes a man so acceptable
to Allah that He pardons the sins that he might have committed.