How to take credit cards online for future payments?

If i am not wrong, Stripe.com can help with this. Check out this link about charging users from your server:

https://stripe.com/docs/tutorials/charges


What you're trying to do can be done with most Payment Service Providers. You essentially want to perform a zero value authorization when a new customer signs up. This has two purposes, it will validate the card details (the payment gateway will send back a 'declined' or 'failed' if there is an issue with the card details), and it also stores the card details with the service provider.

The service provider will return a token id which is what you then submit on any future authorization/charge requests for that customer. With this model you need to be aware that cards can over time become invalid (as they expire, or user replaces a lost/stolen card etc etc).

'Recurring payments' is a slightly different set up and are generally more suitable for subscription based services with regular (eg monthly) payments. The advantage to recurring payments over the previous model is that the service provider should have the ability to automatically update card details on your behalf by using services that Visa and Mastercard provide to report back when cards expire, and to update old card details with new card details.