Caution: Translations of Quran and Ḥadīth may lead to possible misapplications and misinterpretations. This site is intended for students of sacred knowledge that are proficient in comprehending classical Arabic and have a strong foundation in Islamic sciences. Also note that religious injunctions rely on several aspects beyond what one may glean through reading individual aḥādīth.
quran:9:53

Say, "Spend willingly or unwillingly; never will it be accepted from you. Indeed, you have been a defiantly disobedient people."  

Say: ‘Expend, in obedience to God, willingly or unwillingly, it, what you expend, shall not be accepted from you; you are surely a wicked folk’ (the imperative statement here ˹also˺ functions as a predicate).
القرآن:٩:٥٣

قُلْ أَنْفِقُوا طَوْعًا أَوْ كَرْهًا لَنْ يُتَقَبَّلَ مِنْكُمْ ۖ إِنَّكُمْ كُنْتُمْ قَوْمًا فَاسِقِينَ  

{قل أنفقوا} في طاعة الله {طوعا أو كرها لن يتقبل منكم} ما أنفقتموه {إنكم كننتم قوما فاسقين} والأمر هنا بمعنى الخبر.