(If ye publish your almsgiving…) [2:271].
Said al-Kalbi: “When the saying of Allah, exalted is He, (And whatsoever good thing ye spend…) [2:272], the Companions asked: ‘O Messenger of Allah! Is giving alms in secret better or giving it in the open?’ In response Allah revealed this verse”.
Asbab Al-Nuzul by Al-Wahidi , trans. Mokrane Guezzou