At the vending machine in our school, i got a hot chocolate. I wanted to pay, but the machine didn't let me. And you also have to pay with credit card. What am I supposed to do?
This is absolutely not Riba.
Riba is simply an increase in something of the same kind or another thing as a return for it. And it was popular to happen in the Jaahiliyyah when they were requiring more money for debts to be absolute in their due dates.
You intended to pay but couldn't because of an inevitable, sudden technical issue in the vending machine.
It is narrated on the authority of Amir al-Mu'minin (Leader of the Believers), Abu Hafs 'Umar bin al-Khattab (may Allah be pleased with him), who said: I heard the Messenger of Allah (peace be upon him), say:
Actions are according to intentions...
So you didn't do any kind of prohibited doings in Islam unless you were able to get in contact with the manager of the machine or the one taking charge of that place who you should pay them instead; otherwise, it may be considered stealing.
And Allah knows best.
For reading further about Riba, see here.