WHMCS Custom Stripe Payment Gateway
This is a free and open source Stripe Payment Gateway for WHMCS that supports one time and recurring payments without ever having a credit card number hit your WHMCS server. It's pretty neat!
This gateway allows the WHMCS billing system to use Stripe's one time and reoccurring payment gateway capabilities. Stripe provides the unique ability to take a client's credit card information without ever having the client leave your site, but it also allows for credit card data to never get stored in or even pass through your own server, eliminating costly concerns over PCI compliance. This gateway for WHMCS is being released free for anyone, although it should still be considered in beta as there are likely still bugs to work out of it.
Instructions For Use
- Download the Stripe library for PHP. Create a new folder called
/modules/gateways/directory of your WHMCS installation and copy the contents of the
libfolder (from your download) into that newly created folder.
- Copy the file in the repository's root folder called
stripe.phpand place it into the
/modules/gateways/folder of your WHMCS installation.
- From within the
callbackfolder of the repository, copy the other
stripe.phpfile and place it into the
/modules/gateways/callbackfolder of your WHMCS installation.
- Copy the
ccpay.phpfile from the repository into the root directory of your WHMCS installation.
- Finally, copy the
clientareacreditcard-stripe.tplfile into the root level of the theme folder you are currently using for WHMCS. For example, if you're using the
defaulttheme, then copy this file to
- Add a webhook in Stripe to
In the end, your folder structure should look roughly like the diagram below, with a ccpay.php file in the root of your install, a stripe.php in
/modules/gateways/callback, a stripe.php in
clientareacreditcard-stripe.tpl in the root of your WHMCS active template folder, and the
lib folder of the Stripe API in the newly-created
whmcs |-- ccpay.php |-- modules |-- gateways |-- callbacks |-- stripe.php |-- stripe (contains the lib folder of the Stripe PHP API) |-- Stripe |-- ... (files from Stripe API) |-- data |-- ... (files from Stripe API) |-- Stripe.php (Stripe API core file) |-- stripe.php |-- templates |-- yourtemplatename (i.e. default) |-- clientareacreditcard-stripe.tpl
You may now activate this new payment gateway from within WHMCS through the Setup > Payments > Payment Gateways screen. This module should be listed as Stripe. You can then fill in the appropriate API key information as well as a required email address where the gateway can send you any serious errors that come up while billing clients or communicating with Stripe.
Warnings and Notices
- This payment gateway relies on the way it saves an Invoice title and description to Stripe in order to properly function and credit invoices once they are paid. Because of this, you shouldn't attempt to modify the way invoices and plans are displayed in Stripe's web interface.
- This payment gateway assumes that you are using the default WHMCS template based on Twitter's Bootstrap framework. If you are not, or if your theme uses a heavily or otherwise extremely modified version of Bootstrap, double-check to ensure that the Javscript this module uses will still work properly.
- This gateway currently only works in English with United States Dollars as the currency.
Credits and Acknowledgements
This module wouldn't have been possible to make without the help of WHMCS' developer team as well as the staff at Stripe for their great product, well-documented PHP API, and quick support as well. All pieces of code, including the payment gateway template, are the property of their original owners.
I'm always looking to improve this code, so if you see something that can be changed or if you have an idea for a new feature or any other feedback, send me an email to
support *at* next gen web media dot com, or send me a message on Twitter (
@grantdtech), and I'll get right back to you. If you decide to use this module in your WHMCS install, send me a message to say hello (and let me know what you think too) and it'll make my day. Thanks!