Just a quick pointer
B4 going headlong into the xcart appl take time to read around the issue of cc processing
That way you'll understand a lot more than just reading lines and lines of code
Sorry don't have any links to hand but i'm i know there are loadsa sites out there that will be able to help
GM