Saying “Allah is my witness that I will not do such and such” – is it an oath?
Question

I lent someone some money, and two years later I asked him to pay the debt that he owed me, but he denied it and said: “I don’t remember taking any money from you.” After a heated exchange of words, I swore an oath, saying: “Allah is my witness that I shall not ask you for the money again, and Allah is my witness that I shall not take any money from you.” After I swore this oath, he remembered that I had lent him the money. What is the ruling and what should I do? Do I have to offer expiation or not? If I ask him for the money, will I be included in the verse in which Allah, may He be exalted, says (interpretation of the meaning): {So He penalized them with hypocrisy in their hearts until the Day they will meet Him - because they failed Allah in what they promised Him and because they [habitually] used to lie} [at-Tawbah 9:77]?
Praise be to Allah.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.
It says in Nihayat al-Muhtaj (8/178): Saying “Allah is my witness” is a metaphor and is not the usual way of swearing an oath, even though it is to be regarded as an oath in the case of li‘an. But if this phrase is used without explicitly mentioning Allah, then it comes under the heading of idle talk, even if it is intended as an oath.
Ash-Shabramallisi said, commenting on that: That is when you say, “Allah is my witness.” End quote.
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.
The expiation for breaking an oath (kaffarat yamin) is freeing a slave, or feeding ten poor persons, or clothing them. If someone cannot afford to do any of these options, then he must fast for three days, because Allah, may He be exalted, says (interpretation of the meaning):
{Allah will not impose blame upon you for what is meaningless in your oaths, but He will impose blame upon you for [breaking] what you intended of oaths. So its expiation is the feeding of ten needy people from the average of that which you feed your [own] families or clothing them or the freeing of a slave. But whoever cannot find [or afford it] - then a fast of three days [is required]. That is the expiation for oaths when you have sworn. But guard your oaths} [al-Ma’idah 5:89].
And Allah knows best.