Saying “Allah is my witness that I will not do such and such” – is it an oath?
Calling on Allah to bear witness that one will do or will not do something comes under the ruling on oaths, if it was intended as such. So if you intended to swear an oath when you said that, then it is an oath, and you may accept the money and offer expiation for breaking your oath. See the long answer for more details.
5,532