Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SubscriptionItem id not found after SubscriptionSchedule phase change #2025

Open
PabloCastellano opened this issue Feb 7, 2024 · 0 comments
Assignees
Labels

Comments

@PabloCastellano
Copy link
Collaborator

PabloCastellano commented Feb 7, 2024

Describe the bug

I have updated the Price of a Subscription using a SubscriptionSchedule. The SubscriptionSchedule worked fine and now the price is updated. However after the change, the invoice events failed in my backend due to "Invalid subscription_item id: si_LgHurTfBkdLkwd".

The subscription item existed in the database before the phase change. My gut feeling is that dj-stripe has removed it when the event customer.subscription.updated was received. This event changed the items in the subscription (there I could still see the subscriptionitem id in the previous_attributes field).

Not sure if it matters, but both prices (previous and new) depend on customer usage and have two tiers: free up to 1000 and paid from 1000 onwards.

After chatting to Stripe dev support, it looks like the invoice was created because of the schedule phase change, and an hour later it was finalized. Because the phase change got rid of that subscription item, it wasn't accessible when trying to access it via the API. They confirmed this is something that has to be fixed in dj-stripe.

Failing events:

  • invoice.updated
  • invoice.paid
  • invoice.payment_succeeded
  • invoice.finalized

Traceback: Sentry

To Reproduce

  1. Create a Subscription with one tiered SubscriptionItem
  2. Add some usage to the SubscriptionItem
  3. Create a SubscriptionSchedule for the Subscription
  4. Wait until the schedule changes the phase of the Subscription

Software versions

  • Dj-Stripe version: 2.8.3
  • Python version: 3.10.0
  • Django version: 3.2
  • Stripe API version:
  • Database type and version:
@jleclanche jleclanche self-assigned this Feb 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants