Sunan Ibn Majah, Volume 3, Book 22, Hadith 2705 (DarusSalam) ⓘ
It was narrated from Mu'awiyah bin Qurrah, from his father that the Messenger of Allah said: “Whoever makes a will as death approaches, and his will is in accordance with the book of Allah (SWT) it will be an expiation for whatever he did not pay of his Zakah during his lifetime.”
حَدَّثَنَا يَحْيَى بْنُ عُثْمَانَ بْنِ سَعِيدِ بْنِ كَثِيرِ بْنِ دِينَارٍ الْحِمْصِيُّ، حَدَّثَنَا بَقِيَّةُ، عَنْ أَبِي حَلْبَسٍ، عَنْ خُلَيْدِ بْنِ أَبِي خُلَيْدٍ، عَنْ مُعَاوِيَةَ بْنِ قُرَّةَ، عَنْ أَبِيهِ، قَالَ قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم " مَنْ حَضَرَتْهُ الْوَفَاةُ فَأَوْصَى وَكَانَتْ وَصِيَّتُهُ عَلَى كِتَابِ اللَّهِ كَانَتْ كَفَّارَةً لِمَا تَرَكَ مِنْ زَكَاتِهِ فِي حَيَاتِهِ " .
also referenced under: Hadith 2705 (Reference) & Book 22, Hadith 2809 (In-Book)