sync_from_stripe_data syncing incorrect subscriptions
ANG3L0 opened this issue · comments
ANG3L0 commented
Describe the bug
sync_from_stripe_data
is getting an incorrect subscription of the same name.
To Reproduce
- Setup stripe to have plan changes take affect next billing cycle.
- Have stripe cancel immediately, instead of end of period
- Sign up for a plan (call it plan X)
- Cancel that same plan
- Sign up for the same plan again (plan X)
execute:
subscription = stripe.Subscription.retrieve(subscription_id) # retrieves correct subscription
djstripe_subscription = Subscription.sync_from_stripe_data(subscription) # gets incorrect, stale subscription
You will observe that sync_from_stripe_data
now syncs to the cancelled plan in step 3 as opposed to the newest plan in step. This causes major issues because a renewing customer can now see that they don't have a subscription.
Software versions
- Dj-Stripe version: 2.6.1
- Python version: 3.9
- Django version: 3.2.13
- Stripe API version: 3.2.0
- Database type and version: psycopg2-binary==2.9.3