إِن تُبْدُوا۟ ٱلصَّدَقَٰتِ فَنِعِمَّا هِىَ ۖ وَإِن تُخْفُوهَا وَتُؤْتُوهَا ٱلْفُقَرَآءَ فَهُوَ خَيْرٌۭ لَّكُمْ ۚ وَيُكَفِّرُ عَنكُم مِّن سَيِّـَٔاتِكُمْ ۗ وَٱللَّهُ بِمَا تَعْمَلُونَ خَبِيرٌۭ
If you disclose your charitable expenditures, they are good; but if you conceal them and give them to the poor, it is better for you, and He will remove from you some of your misdeeds [thereby]. And Allah, with what you do, is [fully] Acquainted.
Allah then mentions almsgiving that is done in the open and that which is done secretly because they asked about it, saying: (If ye publish) if you show (your almsgiving) which is obligated upon you, (it is well, but if ye hide it) the supererogatory almsgiving (and give it to the poor) the folk of the Platform (ashab al-Suffah), (it will be better for you) than giving it in the open, but both are accepted from you, (and will atone for some of your ill deeds) in proportion of your almsgiving. (Allah is Informed of what ye do). He knows of the alms that you give.