The payment gateway should be provided by your merchant account provider. The gateway is just the method of sending details to the transaction processing server and receiving a response.
For example, I've used authorize.net in the past and this is how they worked.
1)Using SSL, I could encrypt the credit card data, customer details and send it through their gateway for processing and I would get a response back, failed, approved, etc.
2) They provide a secure web site where my customers can enter their details and the transaction is processed wihtout me having to worry about encrypting. My shopping cart sends over the customer's name/address/etc. and the amount of the order. Authorize.net's site contains a form where they put in their credit card info. After they submit, the transaction is processed, then it redirects back to my site with the status of the transaction, approved/declined/ etc.
Authorize.net also can handle recurring billing for you. But you can write a cron job yourself if you need to.
the reason the books you've read don't give enough detail is because there are too many ways to do it to list in a book. E-commerce books usually only tell you how to write a shopping cart, methodologies, etc. but not much about payment processing. Your merchant provider should have all the details on that for you.