- Introduction to Stripe
- Creating a Stripe Payments Test Account
- Getting an SSL Certificate/Setting Up HTTPS
- Creating a Form for Handling Payments with Stripe
- Writing the PHP Code to Process Payments with Stripe
- Handling Stripe Errors
- Stripe Testing and Tricks
I cannot state this more clearly: you should be thinking about using Stripe for every e-commerce project you do. Period. Exclamation mark. Although Stripe has only been around since 2011, it’s quickly made a name for itself as an excellent payment solution that is dead-simple to use. I first heard about Stripe in the winter of 2012, when a client wanted me to use Stripe for his e-commerce project. And I’ve since used it on a couple more projects.
Although Stripe is easy to use, I believe that more documentation, specifically a series that puts together the whole Stripe workflow, is warranted. In this first part of an exhaustive series, I’ll introduce Stripe for those not yet using this great service. In subsequent posts, you’ll learn everything you can ever possibly need to know to use Stipe today. Well, almost everything.
What is Stripe?
In order to best understand what Stripe is, it helps to compare it to the alternatives. In an e-commerce site, you take a customer’s billing information and pass it, along with the order information (e.g., the total), to a payment gateway such as Authorize.net. This an intermediary between the credit card companies and a merchant account. The payment gateway confirms that the charge can be made to the customer’s credit card and passes that charge information to the merchant account. The payment gateway will report the results back to your site, too (of course). The merchant account is what actually allows your business to accept credit card transactions. It coordinates the credit card transactions with your bank account (i.e., getting you your money).
This is the basic premise. Note that you can’t just mix and match pieces here willy-nilly. Different payment gateways and merchant accounts will accept different card types. And different payment gateways, merchant accounts, and bank accounts are setup to work together (or not). Your bank may also be able to act as the merchant account.
Oh, you should also know that there are many fees involved here. The payment gateway will charge a fee and the merchant account will, too.
A popular alternative, particularly for beginning developers, is to use PayPal. PayPal can be used in a couple of ways, but the older, traditional PayPal model has PayPal processing payments internally: from the customer’s PayPal account to yours. If you want to send the money to your bank account from PayPal, you can do that after the fact. Again, PayPal has services that can be used in other ways, including taking credit cards, but this is the standard PayPal model. The PayPal fees tend to be lower than the payment gateway-merchant account route, but your money ends up in PayPal at the end of the process, not in your bank account (until you transfer it).
So how is Stripe different? First, Stripe is a “full-stack” solution, meaning Stripe acts as both the payment gateway and the merchant account. Your website communicates the customer and order information to Stripe, Stripe clears the payment information with the associated credit card company, and Stripe puts the money in your bank account. And…that’s it. You don’t have to do anything special with your bank account to make this happen. You don’t need a special type of bank account. It just works.
Second, and this goes to my next topic of “Why Stripe?”, Stripe is crazy easy to use.
To clarify another point of confusion: different payment systems allow the customer to stay on your site or go to a third-party site and return. The traditional PayPal service takes the customer through PayPal’s site, but PayPal has another service that works behind-the-scenes, leaving the customer on your site the entire time (regardless of whether the customer is paying using her PayPal account or a credit card). Stripe’s system always keeps the customer on your site. Put another way, your customer won’t even know about Stripe.
You have many options when it comes to processing payments, so why should you consider Stripe? (And please note that I’m saying “consider” here: you shouldn’t always use Stripe, just like you pretty much shouldn’t always do anything; more on “Why Not Stripe?” next.)
First, and I cannot stress this enough: Stripe is crazy easy to use. Two questions:
- Do you have a business and a bank account located in one of the countries that Stripe supports?
- Do you have a smattering of Web development skills?
If you can answer “Yes” to both of these questions, you can start taking payments with Stripe today. Literally. Tomorrow, if you want to take your time. Or, if you want, you can be taking live payments within an hour from now. Yes: live payments…within an hour…from now.
Stripe was initially available only in the United States. Then Stripe expanded to Canada. At the time of this writing (this update in April 2015), Stripe is in private betas in other countries, too. Check out “What countries does Stripe support?” to see if you can use Stripe.
You probably can’t fully appreciate how easy Stripe is to use until you do use it, but know now that being easy to use is a core principle at Stripe. In fact, making Stripe easier to use is a recurring goal. Which seems insane to me, because it’s crazy easy to use. Not sure if I mentioned that. But if you’ve hesitated in implementing e-commerce because you thought it was too complicated (e.g., you didn’t understand how a payment gateway differs from a merchant account), then Stripe is your new best friend.
It should go without saying that Stripe offers all the functionality you would expect from any payment system, such as the ability to handle one-time payments or recurring ones (i.e., subscriptions).
Second, Stripe provides good libraries for interacting with the Stripe system in the most popular languages:
Plus, there are third-party libraries available for use. Most decent payment systems offer some libraries and sample code, but in my experience, they’re often terribly outdated; not so with Stripe. Stripe actively maintains its libraries, keeping them up to date with the most current technologies and best practices.
Third, Stripe uses Ajax to transfer the credit card data to their system. Why is that a good thing (besides being all Web 2.0-y)? Through this approach (which I’ll explain in detailed code later in the series), the customer’s credit card data never touches your system. This means that so long as you use the Stripe Ajax system (aka Stripe.js) and load your payment page over SSL, you’ll limit your liability and meet PCI compliance requirements. If you’ve spent more than three minutes looking over PCI requirements, you’ll be able to appreciate this benefit. (Short version: limited PCI compliance burden saves you a ton of time and money.)
Fourth, Stripe’s documentation is very good. In fact, I hesitate to even write this series considering how good the documentation is. They must have some writers over there! This is another area in which Stripe really shines, particularly compared to PayPal. When I was writing my “Effortless E-commerce with PHP and MySQL” book, I spent hours poring through the documentation at different payment providers. More often than not, I was confused and frustrated (and let’s say I already know a few things about handling payments and e-commerce in general). Many companies have too much documentation and documentation that’s not updated. You can spend days weeding through the PayPal docs (literally), often in the format of outdated book-length PDF files. Further, these companies have the annoying habit of frequently changing the names of their services, which makes the outdated and overwhelming documentation even more useless. So not only is Stripe easy to use, but it’s also easy to figure out how to use.
Fifth, as if good documentation wasn’t enough (and sometimes it isn’t), Stripe provides excellent support, including live support. You can start with the Q&A section, which is searchable. If you’re still lost, you can use the #stripe channel on freenode to get live help. It’s actively staffed by the Stripe development team. And if that’s not enough, Stripe also welcomes emails. I’m pretty sure you’re not getting that kind of support from anyone else.
Sixth, for what it’s worth, I find the Stripe people to be very responsive to feedback: if there’s something you think they could do better, they really want to know.
The last reason I’ll mention is that Stripe’s fees are about as good as you’ll get in the industry: for each successful transaction, you pay 2.9% of the total charge plus 30 cents. So a $10 charge costs you 59 cents. A $100 charge costs you $3.20. (The minimum charge is 50 cents.) Again, these rates are fairly standard; I believe PayPal charges about the same. Stripe has no monthly fees or setup fees, and international charges are at the same rates, too. And you won’t be charged for failed payments. If you refund a charge, Stripe refunds its fees, too! (The rates for Stripe accounts in other countries differ slightly.)
Now, personally, I don’t worry about fees too much. As far as I’m concerned, paying too much in fees is a good problem to have. Why? Because it means you’ve got sales and money is coming in. I’m not saying you should be indifferent to the fees you’re paying, I’m just saying it should be near the least of your concerns. If you get to a situation where you’re bringing in so much money that the payment fees bother you, consider yourself blessed. Although, again, I’m pretty confident that Stripe’s fees are as competitive as anyones, if not better than most. And, if you’re quite active, Stripe can work with you on volume pricing.
To be fair, I should say that some of these reasons why you should use Stripe may only be possible because Stripe is still relatively new and not nearly as immense as the behemoths like PayPal. But I’m pretty sure that PayPal never offered this kind of support and there’s ample evidence to believe that Stripe will continue to strive towards ease of use and excellent support as they expand.
Why Not Stripe?
I really like Stripe: not just the service, but also the people behind Stripe and Stripe’s company ethics. I can readily recommend that everyone use Stripe, save for two specific situations:
- If your business isn’t in a supported country.
- You need to support PayPal or other non-credit card payment types.
As for the first situation, Stripe was originally only able to support businesses with United States addresses and bank accounts. They have expanded into Canada, Ireland, and the UK, then Australia, and most of Europe, and… Stripe is continuing to expand its availability around the world, but that’s both technically and legally difficult, so it may take some time to get to where you’re at.
As for the second situation, if, for whatever reason, you feel the need to support payments via PayPal, then it may not make sense to also implement Stripe. You could implement both–Stripe for credit cards and PayPal for only PayPal, but I’m not sure everyone agrees (although I’d be inclined to use both). Stripe also does not support some more esoteric payment options, such as eCheque.
At the time of this writing, Stripe supports Visa, Mastercard, American Express, JCB, Discover, and Diners Club in the United States; Visa, Mastercard, and American Express elsewhere (support doc).
Those, in my mind, are the two biggest reasons why Stripe may not be appropriate for your business. There are other more minor considerations, though.
For one, you can’t use Stripe if you do certain kinds of business. It’s an interesting list that shouldn’t apply to most people, but you can’t use Stripe if your business: is an airline or cruise line, sells age-restricted products, is a bankruptcy lawyer, sells counterfeit goods, is a fortune teller, offers gambling, sells illegal drugs and drug paraphernalia, is a telemarketer, is a pyramid scheme, sells weapons, is involved in pornography, or offers mail-order brides. It’s an interesting list, but someone at Stripe will actually confirm the nature of your business, so don’t think you can skirt this requirement.
You should also know that Stripe will deposit monies into your bank account a couple days after the transaction has occurred. This allows for refunds to be processed or fraudulent charges to be caught. Most payment systems do have a built-in delay, though, except for a PayPal to PayPal transaction. In that case, where money is going from one PayPal account to another, I believe the money gets deposited into your account more quickly, like at the end of the day (I forget, and it’s hard to find out such things in the PayPal documentation). But in that case, it’s still another delay before the money gets to your bank account after authorizing that transfer.
Hopefully this post has managed to tempt you into learning more about Stripe and considering it for your next e-commerce project. If you’d like another developer’s perspective, check out this article (it’s a tad more technical than mine, but good). And, of course, you can just head over to Stripe and start going through the documentation.
In my next post, I’ll walk through setting up an account (which you can use for testing purposes, in case you don’t have a need to handle true payments right now).