I'm afraid the answer to this isn't simple. In the UK, you normally open a special online "Merchant Account", naturally you this will involve security checks for fraud convictions etc. Typically you'd then engage a Payment Service Provider who provide you with software to take the payment, which you call from your code. Some provide a near-COTS website package, some little more than an API. You might want to check out
PayPal[
^] their website is pretty comprehensive.
If this is for a student project I suggest you discuss stubbing the payments system with your supervisor, the will agree as it is unreasonable to expect you to set such a thing up live for a dissertation etc.