#diezler

1 messages · Page 1 of 1 (latest)

spark windBOT
glacial tiger
#

It would be subscription.items.data[0].price.product.id if you're expanding the Product.

keen lotus
#

still getting this error

  File "D:\Programming\Fullstack\webscraping\backend\app\routers\payments\payments.py", line 132, in stripe_webhook
    plan_id = subscription.items.data[0].price.product
              ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'builtin_function_or_method' object has no attribute 'data'
#

i printed the object and it contains those values

#

when i print subscription.items I get <built-in method items of Subscription object at 0x00000178EB240500>

glacial tiger
#

Hm. So if you print subscription what do you get?

keen lotus
#

the full object with all the data

glacial tiger
#

Huh. I don't know why that wouldn't work. Maybe it's a Python thing I'm not aware of. Hang on, let me consult with someone better at Python than me. 🙂

#

Ah, okay, so I guess in Python .items is a built-in property all objects have, so you need to access this using subscription["items"].data[0]...

keen lotus
#

hah, that is weird but simple. works now👍

#

thx

glacial tiger
#

Happy to help!