Well, decide on a payment gateway you want to work with. If you're just looking to learn about this online, I'd recommend going with PayPal's payment gateway. They really don't give good rates (they take a big bite out of the money you charge users), but they have a nice "sandbox" system which you can switch on and off, and it's free to develop with. This lets you run your system as if everything was "live":
- Money will get credited to your sandbox account from the fake credit cards that you create
- Transactions will act just like the live system: you'll get confirmations and notifications just like it was real.
So a good place to start for that would be PayPal's developer site.
Oh, don't be afraid to use some other gateway - all the ones I've used have a way to test their system before it goes live. But many of them do not allow switching back to a "fake"
simulation mode after it's gone live. So adding and testing new features after you got a production system is trickier.