As-Salaam alaikum,
From Sunan at-Tirmidhi, it is mentioned that Anas bin Malik, may Allah be pleased with him, reported that the Messenger of Allah, Sallallahu alaihi Wasallam, said:--

"Indeed Sadaqah (charity) extinguishes the Lord's anger, and it
protects against evil (bad) death."

If Allah Ta'ala was angry with a servant who did something wrong, and he/she immediately gives a charity, Allah loves that and He takes away His anger from that servant who does sadaqah. And charity can be in many ways: in money to those in need, a smile, in visiting homeless people and feeding them or helping them, removing the sorrow of the sorrowful.... things like that.