Django + Stripe Made Easy
Python HTML
Latest commit a134222 Sep 11, 2016 @kavdev Merge pull request #348 from megapctr/patch-1
Proper django version checking



Django + Stripe Made Easy



The full documentation is at


  • Subscription management
  • Designed for easy implementation of post-registration subscription forms
  • Single-unit purchases
  • Works with Django ~=1.9.1, 1.8
  • Works with Python 3.5, 3.4, 2.7
  • Works with Bootstrap 3
  • Built-in migrations
  • Dead-Easy installation
  • Leverages the best of the 3rd party Django package ecosystem
  • djstripe namespace so you can have more than one payments related app
  • Documented
  • Tested
  • Current API version (2012-11-07), in progress of being updated


  1. For only
  2. Only use or support well-maintained third-party libraries
  3. For modern Python and Django


Install dj-stripe:

pip install dj-stripe

Add djstripe to your INSTALLED_APPS:


Add your stripe keys:

STRIPE_PUBLIC_KEY = os.environ.get("STRIPE_PUBLIC_KEY", "<your publishable key>")
STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY", "<your secret key>")

Add some payment plans:

    "monthly": {
        "stripe_plan_id": "pro-monthly",
        "name": "Web App Pro ($24.99/month)",
        "description": "The monthly subscription plan to WebApp",
        "price": 2499,  # $24.99
        "currency": "usd",
        "interval": "month"
    "yearly": {
        "stripe_plan_id": "pro-yearly",
        "name": "Web App Pro ($199/year)",
        "description": "The annual subscription plan to WebApp",
        "price": 19900,  # $199.00
        "currency": "usd",
        "interval": "year"

Add to the

url(r'^payments/', include('djstripe.urls', namespace="djstripe")),

Run the commands:

python migrate

python djstripe_init_customers

python djstripe_init_plans

If you haven't already, add JQuery and the Bootstrap 3.0.0+ JS and CSS to your base template:

<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//">

<!-- Optional theme -->
<link rel="stylesheet" href="//">

<!-- Latest JQuery (IE9+) -->
<script src="//"></script>

<!-- Latest compiled and minified JavaScript -->
<script src="//"></script>

Also, if you don't have it already, add a javascript block to your base.html file:

{% block javascript %}{% endblock %}

Running the Tests

Assuming the tests are run against PostgreSQL:

createdb djstripe
pip install -r requirements_test.txt

Follows Best Practices

This project follows best practices as espoused in Two Scoops of Django: Best Practices for Django 1.8.

Similar Projects