Giving Charity or Repaying Debt?

I have a debt which I owe a relative. I have clear intention to pay it off and the relative trusts in me to pay it back whenever. During Ramadan, I wanted to do good and I pledged a big amount to a charity. I paid half that amount and will shortly pay the other half. Did I do something wrong that is against the teaching of the Prophet (peace and blessings be upon him)? Should I have instead paid my debt down? Should I use the second payment to pay my debt or should I fulfill my promise to the charity?