HyperSaaS
BackendSubscriptions

Management Commands

Django commands for syncing Stripe data.

Management commands provide a way to bulk-sync data from Stripe into the local database. Useful for initial setup, disaster recovery, or periodic reconciliation.

pull_stripe

Orchestrates a full sync of all Stripe data:

python manage.py pull_stripe

Runs these commands in sequence:

  1. update_stripe_products — Syncs products and prices
  2. update_stripe_customers — Syncs customer records
  3. update_stripe_subscriptions — Syncs subscription data

update_stripe_products

Fetches all products and prices from Stripe and updates local records:

python manage.py update_stripe_products

What it does:

  • Creates/updates Product records (id, name, description, active)
  • Creates/updates Price records (id, product, amount, frequency, currency)
  • Syncs feature mappings from product metadata

update_stripe_customers

Fetches Stripe customers and links them to Django users:

python manage.py update_stripe_customers
python manage.py update_stripe_customers --limit 50
python manage.py update_stripe_customers --starting_after cus_abc123
OptionDefaultDescription
-l, --limit100Max customers to fetch (max 100)
-s, --starting_afterPagination cursor (Stripe customer ID)

What it does:

  • Fetches customers from Stripe
  • Creates/links StripeUser records to Django users by email
  • Optionally creates Django users if USER_CREATE_DEFAULTS_ATTRIBUTE_MAP is configured

update_stripe_subscriptions

Fetches subscriptions and updates local records:

python manage.py update_stripe_subscriptions
python manage.py update_stripe_subscriptions --limit 50
python manage.py update_stripe_subscriptions --starting_after sub_abc123
OptionDefaultDescription
-l, --limit100Max subscriptions to fetch (max 100)
-s, --starting_afterPagination cursor (Stripe subscription ID)

What it does:

  • Fetches subscriptions from Stripe
  • Creates/updates Subscription records with all fields
  • Recreates SubscriptionItem records from subscription line items
  • Links subscriptions to StripeUser records

When to Use

ScenarioCommand
Initial deploymentpull_stripe
After restoring databasepull_stripe
Verify webhook data integritypull_stripe
Paginate through large customer listsupdate_stripe_customers --limit 100 --starting_after cus_...
Debug subscription issuesupdate_stripe_subscriptions

Docker Usage

# Local
docker compose -f docker-compose.local.yml run --rm django python manage.py pull_stripe

# Production
docker compose -f docker-compose.production.yml run --rm django python manage.py pull_stripe

On this page