Praise be to Allah.
What is required is to pay zakaat al-fitr before the Eid prayer, because of the report narrated by Ibn ‘Abbaas (may Allah be pleased with him) who said: The Messenger of Allah (blessings and peace of Allah be upon him) enjoined zakaat al-fitr as purification for the fasting person from idle and obscene talk, and to feed the poor. Whoever pays it before the (Eid) prayer, it is a valid zakaat al-fitr, and whoever pays it after the prayer, it is (ordinary) charity.
Narrated by Abu Dawood (1609) and Ibn Maajah (1827); classed as hasan by al-Albaani in Saheeh Abi Dawood and elsewhere.
The apparent meaning of the hadeeth links the time of zakaat al-fitr to the Eid prayer. Once the regular imam has finished his prayer, the time for it comes to an end. The prayer of an individual offered on his own has nothing to do with it, because if we were to say that, there would be no specific time for it. So what counts is the prayer of the imam. But if a person is in a place where no prayer is held, such as in the desert, then he should pay it at the time at which it is paid in the nearest city.
Al-Bahooti (may Allah have mercy on him) said: The best is to pay zakaat al-fitr on the day of Eid before the prayer or around that time in a place where the Eid prayer is not offered, because the Prophet (blessings and peace of Allah be upon him) instructed that it should be paid before the people went out to prayer, according to the hadeeth of Ibn ‘Umar. Some said that it is best if it is paid when going out to the prayer place.
End quote from Kashshaaf al-Qinaa‘, 2/252
And Allah knows best.