There are certain commands of Allāh ﷻ that are obligatory for Muslims – the five pillars. After this there are His ﷻ commands that He ﷻ rewards generously. One of these is ṣadaqah. Allāh ﷻ commands us to give, to give to whomever asks whether rich or poor. Regardless of how it is used, you are rewarded for your intention.