Regarding the hadeeth with the wording:
“Whoever does you a favour, respond in kind, and if you cannot find the means of doing so, then keep praying for him until you think that you have responded in kind.”
Is it better for one to make dua for the person directly towards them or behind their back?
The context is inclining more to repaying the person back directly. Allah knows best. Being we find a couple of narrations of the Prophet sallahu alayhi wa salam and Companions responding to the favours performed for one another with the word “jazaakallahu khairan” while there is no prevention in doing both In Shaa Allah.
“Whoever does you a favor, then reciprocate, and if you cannot, then supplicate for him until you think that you have repaid him.”
Some also use the following narration to show you would utter directly to the person:
Usamah bin Zaid narrated that the Messenger of Allah (sallahu alayhi wa salam ) said:
“ مَنْ صُنِعَ إِلَيْهِ مَعْرُوفٌ فَقَالَ لِفَاعِلِهِ جَزَاكَ اللَّهُ خَيْرًا فَقَدْ أَبْلَغَ فِي الثَّنَاءِ ”
“Whoever some good was done to him, and he says to the person who does him a favour: ‘May Allah reward you in goodness’ then he has praised satisfactorily.”
But this particular hadeeth has been criticized and graded weak.
However, there other narrations which indicate the similar meaning In Shaa Allah:
Usaid bin Hadair said (to ‘A’isha):
جَزَاكِ اللَّهُ خَيْرًا فَوَاللَّهِ مَا نَزَلَ بِكِ أَمْرٌ قَطُّ إِلاَّ جَعَلَ اللَّهُ لَكِ مِنْهُ مَخْرَجًا وَجَعَلَ لِلْمُسْلِمِينَ فِيهِ بَرَكَةً .
“May Allah grant you a good reward! Never has been there an occasion when you were beset with difficulty and Allah did not make you come out of that and made it an occasion of blessing for the Muslims.”
[Reported by al-Bukhaari and Muslim]
It has been narrated on the authority of ‘Abdullah b. ‘Umar who said:
قَالَ حَضَرْتُ أَبِي حِينَ أُصِيبَ فَأَثْنَوْا عَلَيْهِ وَقَالُوا جَزَاكَ اللَّهُ خَيْرًا .
“I was present with my father when he was wounded. People praised him and said: May God give you a noble recompense!”
[Reported by Muslim]
AbdulFattaah Bin Uthman