The Messenger of Allah ﷺ made the Zakat of Fitr obligatory as a purification for the fasting person from idle talk and obscene speech, and as food for the poor. Whoever pays it before the prayer, it is an accepted Zakat, and whoever pays it after the prayer, it is merely a charity among other charities.
حدثنا محمود بن خالد الدمشقي وعبد الله بن عبد الرحمن السمرقندي قالا حدثنا مروان قال عبد الله حدثنا أبو يزيد الخولاني وكان شيخ صدق وكان ابن وهب يروي عنه حدثنا سيار بن عبد الرحمن قال محمود الصدفي عن عكرمة
فرض رسول الله ﷺ زكاة الفطر طهرة للصائم من اللغو والرفث وطعمة للمساكين من أداها قبل الصلاة فهي زكاة مقبولة ومن أداها بعد الصلاة فهي صدقة من الصدقات
Sourcing, [its isnad is hasan]. Ibn Majah narrated it in the chapter on zakat, section on Sadaqat al-Fitr, no. 1827, from the hadith of Marwan bin Muhammad, with this wording. Hakim graded it sahih according to the criterion of Bukhari, 1/409, and Dhahabi agreed with him.