Django + Stripe Made Easy
Clone or download
acamposAccelize and therefromhere Changing model to be compliant with all Database
Moving Charfield with more than 255 char to TextField.
Reducing email field to 255 in order to keep indexing compatibility
Changing migration field to stay align with previous modification.
move back email to 5000 char and field TextField
Removing indexing of email field.
Latest commit c325c39 Dec 11, 2018



Build Status

Stripe Models for Django.


dj-stripe implements all of the Stripe models, for Django. Set up your webhook and start receiving model updates. You will then have a copy of all the Stripe models available in Django models, no API traffic required!

The full documentation is available here:


  • Subscriptions
  • Individual charges
  • Stripe Sources
  • Stripe v2 and v3 support
  • Supports Stripe API 2018-05-21


  • Django >= 2.0
  • Python >= 3.4
  • Supports Stripe exclusively. For PayPal, see dj-paypal instead.
  • PostgreSQL engine (recommended): >= 9.4
  • MySQL engine: MariaDB >= 10.2 or MySQL >= 5.7


Install dj-stripe:

pip install dj-stripe

Add djstripe to your INSTALLED_APPS:


Add your Stripe keys and set the operating mode:

STRIPE_LIVE_PUBLIC_KEY = os.environ.get("STRIPE_LIVE_PUBLIC_KEY", "<your publishable key>")
STRIPE_LIVE_SECRET_KEY = os.environ.get("STRIPE_LIVE_SECRET_KEY", "<your secret key>")
STRIPE_TEST_PUBLIC_KEY = os.environ.get("STRIPE_TEST_PUBLIC_KEY", "<your publishable key>")
STRIPE_TEST_SECRET_KEY = os.environ.get("STRIPE_TEST_SECRET_KEY", "<your secret key>")
STRIPE_LIVE_MODE = False  # Change to True in production

Add some payment plans via the dashboard.

Add to

path("stripe/", include("djstripe.urls", namespace="djstripe")),

Then tell Stripe about the webhook (Stripe webhook docs can be found here) using the full URL of your endpoint from the step above (e.g.

Run the commands:

python migrate

python djstripe_init_customers

python djstripe_sync_plans_from_stripe

Running the Tests

Assuming the tests are run against PostgreSQL:

createdb djstripe
pip install tox

Follows Best Practices

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