I tried to pay him for it but he refused to take my money.
That's strange. Why did not he want you to pay for it?
He said after all I'm a good friend of his.
And a good friend you are for keeping your obligations. He just wanted to return the favor and not have you pay it back. You should accept his goodwill to broaden your relationship.
I don't need him... I'm sick of doing favors for people. I'm about to walk off and leave him.
You don't need to do favors for someone to have a good relationship. Abandoning a good friend because you don't need them is cold. Instead of thinking about whether or not you need them, think about the good things you've done together.