#diezler
1 messages · Page 1 of 1 (latest)
Hello! I think you want subscription.items.data[0].price.product: https://docs.stripe.com/api/subscriptions/object#subscription_object-items-data-price-product
It would be subscription.items.data[0].price.product.id if you're expanding the Product.
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>
Hm. So if you print subscription what do you get?
the full object with all the data
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]...
Happy to help!