Why payment gateway is necessary for on line transaction processing?

Because if we does on line transaction without any gateway then there is a lot of chance for leaking our credit card information and after that other person can do on line transaction with that card so our money will become unsecure . So, payment gateway is needed to enable on line transactions with security.