Individually, a person can decide for themselves. Collectively, the State decides by consultation how much they need for services etc. It is usually referred to as taxation. 10%, 20%, 50%, whatever you do not need for your own living is classed as surplus and should be used for the common good.
2:195 (Defense of the Divine Order calls for sacrifice of wealth and person.) Hence, keep open your resources in the Cause of God, and let not your own hands throw you into destruction. Be beneficent! Indeed, God loves the doers of good. [You might throw yourselves into destruction by withholding contributions to this noble Cause]
2:267. O You who have chosen to be graced with belief! Spend on others the good things you have honourably earned with hard work, whether it is from the product of industry or from the produce of the earth. Do not give away something that you would not like to receive except with closed eyes. Know that God, the Rich, Owner of Praise, provides you indiscriminately and without return.
When the harvest is in, give what is surplus to the needy or State; when the wages are earned, pay your taxes and more.
I was asked this question once before by someone who said no-one would give anything if they were allowed to give what they wanted! I said, ‘read the Quran with meaning and understanding and you will create individuals and societies that will care about others’. Muslims (and non Muslims) already give generously to the needy, when it is organised into Islamic (Quranic) States, the result will be the 'Day of Deen'.