Drupal 7 Commerce Stripe Module

By shane
Wed, 2014-05-14 06:37
Daily Dose of Drupal Episode #149

Share with Others

The Commerce Stripe module integrates Stripe with the Drupal Commerce checkout and payment system. This is one of the easiest services to use when setting up payments for your ecommerce site built using Drupal Commerce.

Keep in mind you will need to download the Libraries module and the Stripe library in order to get this to work (I do not mention this in the video).

In this episode you will learn:

  • How to set up the Commerce Stripe module
  • How to integrate the Drupal Commerce Stripe payment method into the checkout form
  • How to verify payments on the Stripe Dashboard
  • How to use Test and Live mode of Stripe with Drupal Commerce

Hello everyone and welcome to another Daily Dose of Drupal. I am Shane Thomas, you can follow me on Twitter at smthomas3, you can also make sure to follow Adam Learing on Twitter as well at adamlearing.

Today we’re going to going over the Commerce Stripe Module. Anytime you’re building an Ecommerce website you’re going to need some way to manage the payments or take credit card orders through the website and in this case we’re going to use Stripe.

Signing up for a Stripe account is pretty easy so you can go ahead and do that if you decide to use Stripe. We already have an account here and you can see it’s set in Test Mode and you can see there’s been a few test transactions and we’re also going to need the Commerce Stripe Module and it’s just on drupal.org/projects/commerce_stripe. We’re using the 1.0-rc6 branch today.

So the first step is to go ahead and turn that on, you’ll of course need a working Drupal Commerce site before you can even get this bar but assuming you have a working Drupal Commerce site, adding Commerce Stripe is pretty straight forward so we’re going to go ahead and turn this module on and we’ll click save and the first thing that we’re going to want to do is over in our Stripe Dashboard we’re going to want to go to our Account Settings and grab our API Keys because I don’t want you to be posting money to our account or maybe I should show you so you can post money to our account but you want to keep your API Key secrets so I’m not going to show you that but you’ll click here and you’ll be able to grab those and paste those in.

So let’s go ahead and go into our Store Configuration payment methods and you’ll see there’s Stripe and make sure that if it’s disabled you have to enable it first and then you want to click this Edit link and that will allow you to change your API Keys to match whatever is set here in your Stripe Dashboard.

So if you click the Edit here you’re going to see that there’s a rule here that runs so when you’re selecting available payments for an order it’s going to enable the payment method credit card and if you click here we can set the API Keys so I’m going to click there and once you’re on this page you’ll be able to select your Commerce Order for what the order is, select your Currency, here you’ll paste in your secret key and your publishable key from your Stripe Dashboard and you can also select what you want the payment method display title to be the default to let’s say Credit Card.

So you want to enter that in and click Save, we’re going to go ahead and close out of it because I already have it entered from previous link and now we’re going to go ahead and take a look at our Cart which I believe I have a product in here and the product I have is an e-book that we’re actually going to be coming out with your pretty soon called The Five Secrets To Becoming A Drupal 7 Ninja, so keep an eye out of that and make sure to subscribe for the Newsletter if you haven’t already but we’ll go ahead and go through the Checkout Process to see if Stripe has in fact working now.

So go ahead and click Checkout and we’ll need to enter in our Billing Information so I’ll enter in that information and we don’t have a coupon code this time so we’ll go ahead and continue and now you’ll see there’s a payment method called Credit Card that shows up on a checkout page. So I can go ahead and use a test credit card number and this is just 42 … repeated 8 times so it’s 16 digits, select an expiration date that’s in the future, I don’t believe the security code matters, we go ahead and hot continue to go to the next step and this will actually charge our test card and this should make the payment to show up on the Stripe Dashboard.

As you can see we’ve got to the Checkout complete page and now if everything work okay we should see a payment here on our Stripe Dashboard and there you go, you can see that the payment came in and now flipping this thing from Test Mode to Live Mode is as simple as changing this from Test to Live and grabbing the correct Live API Keys rather than the Test API Keys and placing them inside your payment configuration section for the Commerce Stripe Module. And that’s really all there is to it.

So really simple module to collect payments, there’s a lot of different payment modules out here, Stripe is not the only one of course. It just happens to be the one that we’re using or we’ll be using for Code Karate. So go ahead and try that out and let me know if you have any questions and we’ll see you next time, thanks for watching the Daily Dose of Drupal. Bye.