From 34d50976724475e34706da7f8df7e2f25021aa53 Mon Sep 17 00:00:00 2001 From: David Brownman Date: Fri, 7 Aug 2026 12:35:22 -0700 Subject: [PATCH] add "object" to event notification --- stripe/v2/core/_event.py | 5 +++++ tests/test_stripe_context.py | 3 +++ tests/test_v2_event.py | 1 + 3 files changed, 9 insertions(+) diff --git a/stripe/v2/core/_event.py b/stripe/v2/core/_event.py index 393c14d7a..1d630d541 100644 --- a/stripe/v2/core/_event.py +++ b/stripe/v2/core/_event.py @@ -143,6 +143,10 @@ class EventNotification: """ Livemode indicates if the event is from a production(true) or test(false) account. """ + object: str + """ + String representing the object's type. Objects of the same type share the same value. + """ context: Optional[StripeContext] = None """ [Optional] Authentication context needed to fetch the event or related object. @@ -156,6 +160,7 @@ def __init__( self, parsed_body: Dict[str, Any], client: "StripeClient" ) -> None: self.id = parsed_body["id"] + self.object = parsed_body["object"] self.type = parsed_body["type"] self.created = parsed_body["created"] self.livemode = bool(parsed_body.get("livemode")) diff --git a/tests/test_stripe_context.py b/tests/test_stripe_context.py index a06d16dd6..a0f40787f 100644 --- a/tests/test_stripe_context.py +++ b/tests/test_stripe_context.py @@ -156,6 +156,7 @@ def test_event_notification_parsing(self): mock_client = Mock() parsed_body = { "id": "evt_123", + "object": "v2.core.event", "type": "test.event", "created": "2023-01-01T00:00:00Z", "livemode": False, @@ -171,6 +172,7 @@ def test_event_notification_no_context(self): mock_client = Mock() parsed_body = { "id": "evt_123", + "object": "v2.core.event", "type": "test.event", "created": "2023-01-01T00:00:00Z", "livemode": False, @@ -184,6 +186,7 @@ def test_event_notification_empty_context(self): mock_client = Mock() parsed_body = { "id": "evt_123", + "object": "v2.core.event", "type": "test.event", "created": "2023-01-01T00:00:00Z", "livemode": False, diff --git a/tests/test_v2_event.py b/tests/test_v2_event.py index 4ab30d5c4..76a969846 100644 --- a/tests/test_v2_event.py +++ b/tests/test_v2_event.py @@ -102,6 +102,7 @@ def test_parses_event_notif( notif, V1BillingMeterErrorReportTriggeredEventNotification ) assert notif.id == "evt_234" + assert notif.object == "v2.core.event" assert notif.related_object assert notif.related_object.id == "mtr_123"