Yes the people involved in the donation matters. The only thing which does not matter for karma is the thing given, but the receiver may not use the gift if it is useless.
This is because matter, physical objects are meaningless in buddhism. This has far reaching consequences, such as why you cannot get into rigth samadhi by focusing on objects, contrary to what other religious people claim. For instance hindus say that mantras can get them into samadhi but that's not possible, because sounds are meaningless. Same thing with the bath that some people take to wash ''the bad deeds'' they did. Physical objectscannot modify your Concentration and karma, only improving your behavior can work on karma and concentration.
So for giving the usual sutta is this
"I tell you, Vaccha, even if a person throws the rinsings of a bowl or
a cup into a village pool or pond, thinking, 'May whatever animals
live here feed on this,' that would be a source of merit, to say
nothing of what is given to human beings. But I do say that what is
given to a virtuous person is of great fruit, and not so much what is
given to an unvirtuous person. And the virtuous person has abandoned
five factors and is endowed with five.
"And how is a donation endowed with six factors? There is the case
where there are the three factors of the donor, the three factors of
"And which are the three factors of the donor? There is the case where
the donor, before giving, is glad; while giving, his/her mind is
bright & clear; and after giving is gratified. These are the three
factors of the donor.
"And which are the three factors of the recipients? There is the case
where the recipients are free of passion or are practicing for the
subduing of passion; free of aversion or practicing for the subduing
of aversion; and free of delusion or practicing for the subduing of
delusion. These are the three factors of the recipients.
"Such are the three factors of the donor, the three factors of the
recipients. And this is how a donation is endowed with six factors.