You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Calling sync_from_stripe_data from a newly created Customer object in stripe is creating an infinite loop.
To Reproduce
By following the Stripe docs - create a PaymentMethod in stripe via elements and then try to create a Customer in the backend:
customer=stripe.Customer.create(
payment_method=payment_method, # from requestemail=email, # from requestinvoice_settings={
'default_payment_method': payment_method,
},
)
# this call hangs foreverdjstripe_customer=djstripe.models.Customer.sync_from_stripe_data(customer)
I added some print statements to StripeModel._get_or_create_from_stripe_object to see what was going on and basically it just keeps bouncing back and forth like this:
get or create from stripe object: <class 'djstripe.models.core.Customer'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
get or create from stripe object: <class 'djstripe.models.core.Customer'> pm_1GGhFqIYTEfulA0yB7etKVBt
get or create from stripe object: <class 'djstripe.models.payment_methods.PaymentMethod'> cus_GoJtPNFHEqy7uH
Expected behavior
I would ideally expect it to create the Customer and PaymentMethod once.
If that's too difficult then I would expect it to raise an Exception when it hits a recursive creation.
Environment
dj-stripe version: 2.2.2.
Your Stripe account's default API version: 2019-12-03
Database: Postgres 10
Python version: 3.5.2
Django version: 2.2.10
Can you reproduce the issue with the latest version of master?
I haven't tried yet.
The text was updated successfully, but these errors were encountered:
I am seeing this as well. My issue was related to having multiple developers local environments hooked up to the same Stripe environment. Customer update events would trigger this if they weren't in the local with correct djstripe_id.
Describe the bug
Calling
sync_from_stripe_datafrom a newly createdCustomerobject in stripe is creating an infinite loop.To Reproduce
By following the Stripe docs - create a PaymentMethod in stripe via elements and then try to create a
Customerin the backend:I added some print statements to
StripeModel._get_or_create_from_stripe_objectto see what was going on and basically it just keeps bouncing back and forth like this:Expected behavior
I would ideally expect it to create the
CustomerandPaymentMethodonce.If that's too difficult then I would expect it to raise an Exception when it hits a recursive creation.
Environment
Can you reproduce the issue with the latest version of master?
I haven't tried yet.
The text was updated successfully, but these errors were encountered: