Answering backwards...
They plug into the banks ordering systems for authentication. Settlement is either driven by the provider of the authentication, or the details are passed by them to the bank you process your credit cards through for settlement.
Don't know about freeware / shareware, but any good shopping cart software should come with full checkout including card processing functionaltiy.
A problem with a diy approach is this will need to be served from a secure server, with the certification and ongoing maintainance requirements to ensure the server is patched and secure.
http://www.netinvest.co.uk/ncr/netbanx/
offer the settlement services. Others do also. You may want to look at how you pass information to such a system.
Edit - I chose the alternative which is to use Demon Commerce package that deals with all the hosting card account set up etc.
http://www.demon.net/products/webcommerce/
It's not free though.