Get the distribution

At the command line:

$ 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 = <True or False>

Add some payment plans via the dashboard or the django ORM.

Add the following to the urlpatterns in your to expose the webhook endpoint:

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

Run the commands:

python migrate

python djstripe_init_customers

Running Tests

Assuming the tests are run against PostgreSQL:

createdb djstripe
pip install -r tests/requirements.txt