Quite regularly I happen to meet the challenge of building something on the Force.com platform that is not exactly a CRM application. Exposing a public site as a storefront and integrating payment into it is quite that kind of app. We decided to use Stripe as a payment provider – its handling fees are moderate and it’s an API-first platform, using RESTful webservices and JSON objects for all communication. It’s doesn’t take a lot of knowledge about platforms to realize that anything that speaks JSON via HTTPS is a good choice to build things that seamlessly integrate.
And it gets even better: Cirruspath open-sourced an Apex-Library named “stripeforce” on github, so there’s even as foundation to build upon.
So much for the good part of it, yet there’s a big bummer to come: Stripeforce isn’t that easy to deploy to your org. Test coverage is as low as 68% (and very hard to push higher), and even worse, it’s even hard to install to any development org because the classes have several cross-dependencies, so I spent about an hour, commenting-out references, uncommenting them again etc. But there’s at least something good about it: I decided to give back to the community and write about these efforts (so that others hopefully find it easier to implement Stripe) and make some examples public and open source and return some pull requests to the main repo and eventually package the Stripe libraries so that you can install it more easily.
For now, I started with a sample Visualforce page that exposes a form, collects some payment data, and upon submitting the form, gets a Stripe token, starts a transaction and saves the results to an account. It’s open source on github (https://github.com/dstdia/VFSampleStripe), feel free to try it out, correct my mistakes etc. You need a Stripe account to get your secret and publishable keys, you need a Salesforce dev org at least (and StripeForce installed on your org). So: Prerequisites are high, but I promise to help making it easier to use Stripe payments in Apex and Visualforce.