Bulugh al-Maram 630
وَعَنِ ابْنِ عَبَّاسٍ رَضِيَ اللَّهُ عَنْهُمَا قَالَ: فَرَضَ رَسُولُ اللَّهِ - صلى الله عليه وسلم - زَكَاةَ الْفِطْرِ; طُهْرَةً لِلصَّائِمِ مِنَ اللَّغْوِ وَالرَّفَثِ, وَطُعْمَةً لِلْمَسَاكِينِ, فَمَنْ أَدَّاهَا قَبْلَ الصَّلَاةِ فَهِيَ زَكَاةٌ مَقْبُولَةٌ, وَمَنْ أَدَّاهَا بَعْدَ الصَّلَاةِ فَهِيَ صَدَقَةٌ مِنَ الصَّدَقَاتِ. رَوَاهُ أَبُو دَاوُدَ, وَابْنُ مَاجَهْ, وَصَحَّحَهُ الْحَاكِمُ.
From Ibn ʿAbbas, may Allah be pleased with them both, who said: The Messenger of Allah ﷺ made zakat al-fitr obligatory as a purification for the fasting person from idle talk and obscenity, and as food for the poor. Whoever pays it before the prayer, it is an accepted zakah, and whoever pays it after the prayer, it is a sadaqah among sadaqahs. Reported by Abu Dawud and Ibn Majah; al-Hakim graded it sahih.