pinax / pinax-stripe-light

a payments Django app for Stripe
MIT License
687 stars 286 forks source link

Stripe Subscriptions error webhook #575

Open hanstakeshi opened 6 years ago

hanstakeshi commented 6 years ago

Issue Summary

We are getting a bit of trouble with the webhook called "invoice.payment_succeeded". All the subscriptions are created in the dashboard with the format "sub_DCXg.....", but the package make internal an id subscription with the format "sli_ABcDX..." (we dont know why).

In the function sync_invoice_items (pinax/stripe/actions/invoices.py), it is doing a comparation with invoice.subscription.stripe_id and item["id"] but they are different: image

image so in the else, it try to retrieve the subscription with the fields customer and the item id but it doesnt exist in my dashboard stripe panel raising an error:

image

image

blueyed commented 6 years ago

Have you checked the event and EventProcessingException logs / entries to see where "sli_*" is coming from?

hanstakeshi commented 6 years ago

Hello blueyed, thank you for the answer. i've been checked that error, and literally it show the same information. image

We've already an account in Stripe for international payments using pinax-stripe(pinax-stripe==4.3.0), but it doesn't have any error in the webhook called invoice.payment_succeeded... (this Stripe account was created four years ago, and it's using webhook's version 2014, that's the unique diferente between this new Stripe account and the old Stripe account)

Greetings.

k3oni commented 5 years ago

The issue is due to the new stripe api version. Edit pinax/stripe/actions/invoices.py line 167 from item["id"] to item["subscription"] .