Welcome to WebmasterWorld Guest from 220.127.116.11
A tracking system would have to be set up for referring IDs, the clicks and leads/sales would need to be logged and analyzed. A reporting system would be set up, either site-based or email-based, for giving stats to affiliates. You would also want to generate your own reports for your top performing affiliates, and overall stats. Then you would need a simple accounting setup for payments, amounts due, chargebacks, etc.
This can all be quite a task. If the site development is being handled by a team, or at least has a staff programmer, doing it yourself could be a good option. I have worked with many inhouse programs that have their own custom solutions, and they usually work fine. However, the few programs that I have had problems with in the past, usually with stats/tracking, were mostly from inhouse, custom coded programs. It would probably be better (and more cost effective) to set this up during initial site development, but not absolutely necessary. I would look closely at this option if you already have a good bit of custom coding and database work to do.
If initial development costs need to be low, or these types of tasks are beyond the developer(s) area of expertise, you can use off-the-shelf software specially designed to automate these tasks. I have seen decent ones range from $500-$1000, and probably much more. This should give you some additional support, if problems arise. You could set this up during initial development or easily add it later.
Another option, if you want a CPS program, is to use a CC merchant with affiliate program/tracking as part of the package.