Recurring billing – Now baked right into Drupal Commerce 2
If you ever have need of timed or delayed payments, we have some good news: recurring billing (also known as subscriptions) is new and improved in Commerce 2. Check out this week's High5 episode and learn more!
What is recurring billing?
It's anything where we want to have a transaction happen after the initial time when a customer is on our site. That might be monthly or yearly, or it might be when you want the last half of the payment to go through in a couple of days or a week.
How does it work?
It's not like we store pictures of everyone's credit cards and just keep applying charges to them. Instead, we store tokens or references to credit cards. This is much safer because it means that even if the site got hacked, no one would have access to your actual banking information. At no point does Drupal Commerce ever store your actual credit card.
If you're interested in reading more about tokenization, Wikipedia has a lot of good information on the subject.
How is this different from Commerce 1?
We sort of had tokenization (a.k.a card on file) in Commerce 1. It was a contrib module and wasn't actually part of Commerce itself. Some payment gateways supported it, some didn't, some did but only partially… it was much more of an ad hoc thing.
Now, tokenization is built into Commerce, so any major payment gateway that gets set up and has the capacity to store tokens (which is most of them), will do so. You don't need to do anything special for your payment gateway to handle recurring billings. As long as we have that token, we can keep making charges to it until that token becomes invalid (i.e. the card gets cancelled).
It was actually a credit to Commerce 1 that it had tokenization at all. It's a complex thing. For instance, if a payment doesn't go through, do we have to cancel the subscription? Do we have to get the product back? Do we do that immediately, or give them a window of time to put in the new card? A lot of ecommerce setups just avoided that entirely, so it was definitely a strength of Commerce 1, and now it's really a strength of Commerce 2.
The bottom line
Recurring billing rocks, and is now built right into Commerce 2.