- 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
When you go to use any payment system for the first time on a project, you’ll need to create a test account. As with almost every step of the process, Stripe again makes this ridiculously easy. In this post I’ll explain how to create a test account in Stripe, and how that process is different than the other payment systems I’ve worked with, in a couple of ways. If you’re not currently planning on using Stripe, you may want to read my first post in this series, which explains how Stripe works and what its pros and cons are.
With most payment systems I’ve used, testing is done in one of two ways:
- Create a test account, which is entirely separate from the live account
- Create a real account, but send test transactions through a separate system
For example, in my “Effortless E-commerce with PHP and MySQL” book, I did one project that used PayPal, and all the test transactions go through PayPal’s “sandbox” using a test account, which is different than your real PayPal account. When it’s time to go live, you then switch your code to use the real PayPal and your real account. For another example in that book, Authorize.net was used. Authorize.net allows you to create a real account and use it in testing mode, or create a test account without ever creating a live account. (Stripe didn’t exist at the time I wrote the book, although I now cover Stripe in the second edition of “Effortless E-commerce with PHP and MySQL“.)
So how do you create a test account in Stripe? Well, the first thing you’ll want to decide is whether you want an account at all. Wait…what?
You can try out Stripe—live (although not taking real payments)—without ever creating an account, providing your email address, etc. How great is that?
Creating a Test Account
Yes, if you want to just tinker with Stripe for an afternoon, you can skip registration, get your test keys, and play. To do that,
- Head to https://stripe.com.
- Click “Sign In”.
- On the Sign In page, click “Sign up”, next to “Don’t have an account?”.
- Click “skip this step” and you’ll be able to access a temporary, unnamed account that can be used for testing purposes.
- On the resulting page (what Stripe calls your dashboard), click “Your Account”.
- In the “Your Account” control panel, click “API Keys” to find usable keys.
At this point you really are good to go. You can create and test transactions and then view those transactions in the Stripe Dashboard. Because you don’t have a real account, though, you can’t come back to the same Dashboard another day. That being said, after you’ve played a little bit, you can click “Save account” to make it real if you want.
If you know you want an actual Stripe account, then you should go ahead and create one from the get-go. Just enter your email address and password in Step 3 above and follow the prompts.
Testing vs. Live
Another interesting thing about using Stripe is the difference between how you test Stripe transactions and how you implement live transactions. As you’ll see later in this series, the only difference is in the use of the two API keys (see the above figure). You will develop your site using the test API keys (one key is public, used in the client; the other key is private, used on the server). Then, when the site is ready to go live, you swap those out for the real API keys. You don’t have to change any other code, including the URL used to communicate with Stripe (which, as you’ll discover, you never see anyway). This also means that you can run test transactions through your site while customers are simultaneously running live transactions!
TIP: You can continue to test Stripe transactions while your site is live because Stripe accounts are not in binary live/test modes as in some other payment systems.
Activating Your Account
The only thing you’ll need to do before taking your Stripe account live is activate your account. To do that, you’ll need to fill out a form in the Stripe dashboard, providing:
- A description of your product/business (i.e., what you sell, what your URL is, how much business you expect to do, etc.)
- Your business’s legal details (country, business type, legal name, employer ID number, and address)
- Your personal and contact information
- Your bank details (i.e., where the money should go)
Stripe takes this seriously, so they will validate you and your company’s identification (e.g., your social security number). On the other hand, Stripe won’t randomly lock your account once it’s been activated because some transaction raised a flag in their automated system of blind checks (unlike, say, PayPal).
Now you know how to create a test account in Stripe, or a live one if you’re ready for that. In the next post in this series, I’m going to explain how to obtain an SSL certificate, which you’ll need when it’s time to handle live transactions.