#victoria-event-object
1 messages · Page 1 of 1 (latest)
Hi there! What language are you using?
In Node you should be able to access properties via dot notation
Hi, im using Python
I believe the same is true of Python though I'm not a Python dev
It is possible in Python, but its necessary to create a method to emulate the access of dict key like a model attribute (via dot).
I was wonder if stripe did this method in the background
or i am missing something
delivery_id = event.data.object.custom_fields[0]["value"]
if event["data"]["object"]["object"] == "payment_intent":
invoice_id = event.data.object.invoice```
i was wonder why this works
you can see that i access the event object in two ways
👋 Hopping in to help!
We use a custom object to support dot notation and accessing them traditionally as a dict
Hi @clever hemlock !
Wow! yeah this was exactly my question!!
So in both ways is possible, and i can switch between them anytime?
Yes, you can switch between them, but there are some thing that will only work with the dict notation - specifically, subscription items have to be accessed like 'subscription[items]'. 'subscription.items' will not work because items() is a built in function (https://docs.python.org/3/library/stdtypes.html#dict.items)