Describe the bug
Using client.parse_event_notification to parse webhook events.
The payload is supposedly described here https://docs.stripe.com/api/v2/core/events
which documents a payload having: "object": "v2.core.event", property.
Indeed, the gem's own "V2" checking looks for :object -
|
if data[:object] == "v2.core.event" |
So the expectation is that a webhook endpoint should be able to look:
(json_payload.dig(:object) || parsed_event.try(:object)) == "v2.core.event" to ascertain whether the webhook event is a V2 format or not.
Even a V2 ping is indicated as having an object property:
ping payload from events log
{
"created": "2026-04-29T16:27:50.520Z",
"id": "evt_test_65Uayv8cg97C3LFQYdF16TfJjvRiSQ3NDL3s0hpoTYO836",
"object": "v2.core.event",
"type": "v2.core.event_destination.ping",
"data": {},
"livemode": false,
"reason": {
"type": "request",
"request": {
"id": "req_v2fHbmB3KZ0nY2zzQ",
"idempotency_key": "4ebc22f3-658e-35b3-b55a-6fa5d70cefc3"
}
},
"related_object": {
"id": "ed_test_61UaJd6BLMqoJDHXW16TfJjvRiSQ3NDL3s0hpoTYORvc",
"type": "v2.core.event_destination",
"url": "/v2/core/event_destinations/ed_test_61UaJd6BLMqoJDHXW16TfJjvRiSQ3NDL3s0hpoTYORvc"
},
"changes": null
}
And yet, the resulting parsed event object does not respond to object!!!
NoMethodError Exception: undefined method 'object' for an instance of Stripe::Events::V2CoreEventDestinationPingEventNotification
To Reproduce
- Send V2 ping event.
- parse with
client.parse_event_notification
- read
parsed_event.object
Expected behavior
I expected .object to be a method on all objects and payloads, as indicated in the Stripe object docs and json samples.
That way we could have a simple and consistent way to ascertain whether an event object (or payload) is V1 or V2.
Feature request would be for the Stripe gem to have a utility method that we could just use directly.
Code snippets
OS
macos
Language version
3.1.4
Library version
18.4.1
API version
2026-02-25.clover
Additional context
No response
Describe the bug
Using
client.parse_event_notificationto parse webhook events.The payload is supposedly described here https://docs.stripe.com/api/v2/core/events
which documents a payload having:
"object": "v2.core.event",property.Indeed, the gem's own "V2" checking looks for
:object-stripe-ruby/lib/stripe/webhook.rb
Line 22 in 0b1d66f
So the expectation is that a webhook endpoint should be able to look:
(json_payload.dig(:object) || parsed_event.try(:object)) == "v2.core.event"to ascertain whether the webhook event is a V2 format or not.Even a V2 ping is indicated as having an object property:
ping payload from events log
And yet, the resulting parsed event object does not respond to
object!!!To Reproduce
client.parse_event_notificationparsed_event.objectExpected behavior
I expected
.objectto be a method on all objects and payloads, as indicated in the Stripe object docs and json samples.That way we could have a simple and consistent way to ascertain whether an event object (or payload) is V1 or V2.
Feature request would be for the Stripe gem to have a utility method that we could just use directly.
Code snippets
OS
macos
Language version
3.1.4
Library version
18.4.1
API version
2026-02-25.clover
Additional context
No response