I accidentally claimed the American Opportunity Credit and have received the refund 2 days ago. Will I receive a penalty or can I fix this just by paying back the IRS?

I misunderstood the qualifications for the AOC and claimed the credit. I found out a few days after filing that I shouldn't have claimed it. I just received the refund and am worried that I will be penalized. I am not sure how serious this is because I did not owe anything else to the IRS. Is there a way that I can fix the problem by just filing an amendment and paying back the money or will I get penalized?