Umar appointed me to collect the zakat. When I had finished and handed it over to him, he ordered that I be given a payment for my work.I said, "I only did the work for the sake of Allah, and my reward is with Allah."He replied, "Take what you are given. I myself worked in this capacity during the time of the Messenger of Allah ﷺ, and he assigned me payment. I said the same thing you have just said, and the Messenger of Allah ﷺ told me, 'When you are given something without having asked for it, then eat from it and give in charity.'"
حدثنا أبو الوليد الطيالسي حدثنا الليث عن بكير بن عبد الله بن الأشج عن بسر بن سعيد
استعملني عمر رضي الله عنه على الصدقة فلما فرغت منها وأديتها إليه أمر لي بعمالة فقلت إنما عملت لله وأجري على الله قال خذ ما أعطيت فإني قد عملت على عهد رسول الله ﷺ فعملني فقلت مثل قولك فقال لي رسول الله ﷺ إذا أعطيت شيئا من غير أن تسأله فكل وتصدق
Muslim narrated it in the Book of Zakat, Chapter on the permissibility of taking without asking or seeking, hadith 1045, from the narration of Layth bin Saad, with this wording. Bukhari narrated it in the Book of Rulings, Chapter on the provisions of rulers and officials over it, hadith 7163, through another route from Ibn Saadi, with this wording.