djstripe.managers

dj-stripe model managers

ChargeManager

Bases: models.Manager

Manager used by models.Charge.

status is still a concrete column on Charge, but paid, refunded, disputed, and amount_refunded were moved to stripe_data in dj-stripe 2.10 and require JSON lookups.

disputed

disputed(self)

during

during(self, year, month)

Return Charges created during a certain month, in UTC.

Stripe stores created as a UTC Unix timestamp, so the month is selected by an explicit UTC datetime range rather than the timezone-sensitive created__year/__month lookups.

failed

failed(self)

paid_totals_for

paid_totals_for(self, year, month)

refunded

refunded(self)

succeeded

succeeded(self)

StripeModelManager

Bases: models.Manager

Manager used in StripeModel.

SubscriptionManager

Bases: models.Manager

Manager used in models.Subscription.

Most Subscription fields are read from stripe_data (a JSONField) since the dj-stripe 2.10 refactor removed them as concrete columns. ORM filters must therefore use stripe_data__<key> lookups. Date-like fields (start_date, canceled_at, trial_end) are stored as Unix timestamps in the JSON, so range filters are expressed against integer bounds.

active

active(self)

Return active Subscriptions.

active_plan_summary

active_plan_summary(self)

Return active Subscriptions with plan counts annotated.

canceled

canceled(self)

Return canceled Subscriptions.

canceled_during

canceled_during(self, year, month)

Return Subscriptions canceled during a certain time range.

canceled_plan_summary_for

canceled_plan_summary_for(self, year, month)

Return Subscriptions canceled within a time range with plan counts annotated.

churn

churn(self)

expiring_trials

expiring_trials(self, days = 7)

incomplete

incomplete(self)

past_due

past_due(self)

started_during

started_during(self, year, month)

Return Subscriptions not in trial status between a certain time range.

started_plan_summary_for

started_plan_summary_for(self, year, month)

Return started_during Subscriptions with plan counts annotated.

trialing

trialing(self)

TransferManager

Bases: models.Manager

Manager used by models.Transfer.

Transfer-level fields (status, amount, failure_code) live in stripe_data as of dj-stripe 2.10.

during

during(self, year, month)

Return Transfers created during a certain month, in UTC.

Stripe stores created as a UTC Unix timestamp, so the month is selected by an explicit UTC datetime range rather than the timezone-sensitive created__year/__month lookups.

failed

failed(self)

paid_totals_for

paid_totals_for(self, year, month)

pending

pending(self)