Ryan Huff is the co-founder and CEO of Cirruspath, the makers of Cirrus Insight.
Most apps on the Salesforce AppExchange are managed packages and the ISVs that develop them can leverage all the tools that AppExchange partners typically get, like the License Management App (LMA), Patch Orgs and Push Patch Updates, and integrated recurring billing. We took a different approach to building our app, Cirrus Insight, when we wanted to develop a solution for integrating Google Apps and Salesforce CRM. Cirrus Insight, by contrast, is a browser extension; and we don’t get to take advantage of these cool toys — so we had to build them ourselves.
Before we publicly released Cirrus Insight, we developed our own LMA in our Salesforce org and worked out a solution for live updates. Managing recurring billing was the final piece, and not one I was looking forward to because I had had challenges with it in the past. I’d worked with PayPal, Authorize.Net, and a handful of other systems in the previously and it was always difficult to make them work smoothly with our business processes. I set out to find a better solution, and I was looking for a few key things:
- Easily manage recurring billing
- Simplify PCI compliance: I didn’t want to ever see a customer’s credit card
- A simple and logical API that would make it easy to integrate with Salesforce
Long story short, we found Stripe, who easily met all of these requirements. Within a week we had our custom built LMA and website hooked up and ready to take payments and manage recurring billing.
Open Sourcing the Stripe SDK for Salesforce
Over the last 2+ years, we’ve streamlined and improved the library we built to integrate with Stripe. When salesforce.com recently announced their partnership with Stripe to provide the recurring billing platform for Salesforce AppExchange partners, we felt it was a good opportunity to open up the library to help out other partners and developers in the Force.com community.
To get started, head to Github and fork the stripeforce repo. Now you have your own copy of the code to do with as you wish. But we encourage your contributions to the library if you have something to share.
Where the SDK Fits In
The SDK handles communication to Stripe. Your specific business logic, and how it fits into your Salesforce org, is up to you. For instance, if you want to create a customer with a token from Checkout and add the customer to a subscription:
Stripe handles our recurring billing and manages when subscriptions are ready to be charged. We needed a way to get that information back into Salesforce and our accounting system. Stripe supports Webhooks, which means that Stripe will POST to any URL you provide with the data about a transaction that just took place.
The SDK includes a simple interface for handling Stripe webhooks. For each type of webhook, the interface will pass the Stripe data object received in the webhook to a method for that webhook event type (the readme in the Github project explains the details). You’re in control of what happens next since you write the logic in that method. This diagram may help describe a real-world scenario:
Contributing to the SDK
We’ve been using the SDK at Cirruspath for a couple years now. But we’re not using everything that Stripe can do. When you find use cases that haven’t been built out yet with the SDK, send a pull request so that those contributions can be included in the library and others can benefit.
If you have questions about using or contributing to the SDK, post them to the Github project and the repo contributors will be right on it.