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

Cannot sync customers - KeyError Invoices #623

Open
support-wantify opened this issue Dec 18, 2018 · 5 comments · Fixed by deployed/pinax-stripe#1 or #622 · May be fixed by #630
Open

Cannot sync customers - KeyError Invoices #623

support-wantify opened this issue Dec 18, 2018 · 5 comments · Fixed by deployed/pinax-stripe#1 or #622 · May be fixed by #630

Comments

@support-wantify
Copy link

Issue Summary

Traceback (most recent call last):
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/stripe/stripe_object.py", line 83, in getattr
return self[k]
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/stripe/stripe_object.py", line 122, in getitem
raise err
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/stripe/stripe_object.py", line 111, in getitem
return super(StripeObject, self).getitem(k)
KeyError: 'invoices'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "./manage.py", line 12, in
execute_from_command_line(sys.argv)
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/django/core/management/init.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/django/core/management/init.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/pinax/stripe/management/commands/sync_customers.py", line 35, in handle
invoices.sync_invoices_for_customer(customer)
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/pinax/stripe/actions/invoices.py", line 135, in sync_invoices_for_customer
for invoice in customer.stripe_customer.invoices().data:
File "/Users/andy/Desktop/Projects/nufios/nufios_wt/env/lib/python3.7/site-packages/stripe/stripe_object.py", line 85, in getattr
raise AttributeError(*err.args)
AttributeError: invoices


If this is a bug instead of a question or feature request, please fill out the sections below.


Steps to Reproduce

This happens upon running ./manage.py sync_customers - not the initial use of it, but once putting in test customers

What were you expecting to happen?

Customers to sync

What actually happened?

The above error message

@polski-g
Copy link

I am getting the same problem.

@blueyed
Copy link
Contributor

blueyed commented Jan 19, 2019

Care to fix it? :)

@polski-g
Copy link

charges.py, change line 163 from:
for charge in customer.stripe_customer.charges().data:
to:
for charge in stripe.Charge.auto_paging_iter(customer=customer.stripe_id):

invoices.py, change line 134 from:
for invoice in customer.stripe_customer.invoices().data:
to:
for invoice in stripe.Invoice.auto_paging_iter(customer=customer.stripe_id):

@blueyed
Copy link
Contributor

blueyed commented Jan 19, 2019

Please consider creating a PR.
I cannot promise it will be merged etc, but would make it easier.
(I am not using this feature myself)

@ivellios
Copy link

ivellios commented Feb 6, 2019

I have created PR based on the comment above for that issue as we are also facing the problem. Hope it will help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment