What is dj-stripe?
dj-stripe implements Stripe models, for Django. It continuously syncs your Stripe data to your local database via webhooks, exposing it as native Django models. You work with subscriptions, invoices, charges and the rest of the Stripe object graph through the Django ORM — querying your own database instead of making repeated, slower calls to the Stripe API.
Set up your webhook endpoint, point Stripe at it, and your database stays in sync with Stripe automatically.
Why use it?
- Query Stripe data with the ORM. A customer's subscriptions, invoices and payment methods are Django models with real foreign keys. Fetch a customer and their related objects in a single query instead of several network round-trips.
- Stay in sync automatically. dj-stripe's webhook handlers keep your local models up to date as things change in Stripe. You can also sync on demand.
- Built-in webhook handling. Signature verification, event storage and Django signals for every event type, out of the box.
- Multiple accounts and API keys. Operate on behalf of several Stripe accounts from a single instance — see Managing API keys.
- Tested against the latest Stripe API. dj-stripe pins a known-good Stripe API version (see API versions).
Getting started
- Install dj-stripe and run its migrations.
- Add your Stripe API keys.
- Set up a webhook endpoint so Stripe can notify your app.
- Sync your existing Stripe data.
From there, the usage guides cover the common flows: subscribing customers, creating charges, using Stripe Checkout, and reacting to webhook events.
Tutorials
Community-written tutorials and blog posts. These are maintained externally and may target older versions of dj-stripe, Django or the Stripe API — treat them as supplementary to this documentation.
Written something about dj-stripe? Open a pull request to add it here.