(30) باب عَلَى كُلِّ مُسْلِمٍ صَدَقَةٌ، فَمَنْ لَمْ يَجِدْ فَلْيَعْمَلْ بِالْمَعْرُوفِ
Narrated Abu Burda:
from his father from his grandfather that the Prophet (ﷺ) said, "Every Muslim has to give in charity." The people asked, "O Allah's Prophet! If someone has nothing to give, what will he do?" He said, "He should work with his hands and benefit himself and also give in charity (from what he earns)." The people further asked, "If he cannot find even that?" He replied, "He should help the needy who appeal for help." Then the people asked, "If he cannot do that?" He replied, "Then he should perform good deeds and keep away from evil deeds and this will be regarded as charitable deeds."
Reference: Sahih al-Bukhari 1445
In-book reference: Book 24, Hadith 48
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 2, Book 24, Hadith 524