Note! An updated version of this tutorial can be found here.
One of our most popular blog posts is Having fun with Docker, Stripe and Kill Bill, where we showed how easy it is to leverage the powerful subscription engine offered by Kill Bill while delegating payments to Stripe.
A lot has happened over the past 18 months: tools like docker-machine and docker-compose have become better and recent releases of Kill Bill have removed the need to edit various configuration files post-installation. Let’s take a look at how simpler the installation process has become.
The first step is to create a machine to run your containers. On a mac, you would typically use the virtualbox driver:
docker-machine create -d virtualbox killbill eval $(docker-machine env killbill)
Note that to deploy Kill Bill to the cloud, the steps are similar (simply replace the driver with your provider’s, such as Microsoft Azure for example).
Next, create a docker-compose file similar to the one below:
3 containers will start: one for MariaDB (shared database), one for Kill Bill itself and one for Kaui (Kill Bill admin UI). You can then explore Kill Bill APIs by going to http://192.168.99.100:8080/api.html or log-in to Kaui by going to http://192.168.99.100:9090 (username: admin, password: password) to create your tenant. Note: make sure to replace 192.168.99.100 with the IP of your machine which you can retrieve via
docker-machine ip killbill
The final step is to configure your Stripe credentials. Create a configuration file stripe.yml:
:stripe: :api_secret_key: 'sk_test_aaaabbbbccccdddd'
and upload it via Kaui at http://192.168.99.100:9090/admin_tenants/1:
That’s it! To test your installation, you can run our sample Sinatra app, which will show you how to:
- Use Stripe.js to tokenize the card
- Store the token in Kill Bill for subsequent (or recurring) payments
- Create subscriptions, generate invoices and trigger automatic payments
- Retrieve a Kill Bill payment in your Stripe dashboard
If you run in any integration issue, feel free to reach out to our mailing-list!