Why is it necessary to pay the Spanish school in advance?
Spanish school usually want you to pay them a little while in advance. This makes work a lot easier for them, this way they can arrange a teacher and all related items, etc. knowing you will show up. A lot of travellers tend to change their plans at the last moment.
What are the risks of paying online?
Most schools will ask you to transfer the money into their account, others offer additional services, like payment through paypal or creditcard.
It's up to you to consider whether you are comfortable with these ways of paying for your Spanish classes. If a Spanish school is registered to a chamber of commerce or licensed as a educational institute, ask for their details. This way you can make sure you can always get your money back if things fall through.
How can I safely pay online?
Make sure you know the online payment system the Spanish school suggests to use. Check the website of the payment system to make sure it is absolutely safe to transfer your money through their service.