#Nukesforbreakfast
1 messages ยท Page 1 of 1 (latest)
No, it's not possible to have an event only sent to specific endpoint
interesting. Alright. Would be a nice feature.
is there a universal way to add differentiating metadata to an event? It doesn't seem like all events have a metadata object.
Metadata is on the object, but not event. One way I can think of is to add the query parameter to your endpoint and differentiate where it comes from
sorry, I'm not sure I understand.
what do you mean by
add the query parameter to your endpoint
For example, https://example.com?source=endpoint_a
When you read that the source=endpoint_a, then you only process the event on this specific endpoint, otherwise skip it
are you saying I can add an arbitrary query parameter to my webhook endpoint URL that I configure in Stripe?
oooooh, so I can just add ?source=whatever on the end of the URL and stripe accepts it
now that's interesting. That might be the ticket.
Yup! You may give it a try ๐
Ok, I'll give this a shot. I'll have to see if I can wrangle AWS API gateway to inject that somewhere. It was hell trying to preserve the raw body for signature verification. ๐
Sounds good!
wait, how will that help? If all events go to all endpoints, the query string doesn't really differentiate anything, right? Say I trigger a fixture to send a payment_intent.succeeded event, that will still be sent to each endpoint and each endpoint will have their own source query string.
I need something to say X event trigger is really only for Y endpoint.
Hi @latent sail I'm taking over
As river explained before, the event will be sent to all webhook endpoints that listen to that type of events.
right, so I'm not sure how adding a querystring to the configured endpoint URL helps.
I'm seeing a possible solution, maybe.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
similar to the CLI's override method, perhaps I can inject a specific idempotency key or request ID to differentiate the events?
Let me clarify the requirements. So you want to set up different webhook endpointss that listen to different events? for example
- endpoint A -> listens to
payment_intent.succeeded - endpoint B -> listens to
payment_intent.payment_failed
not quite.
I have a set of code/AWS services used to validate and route webhook events to the right consumers along with validating the signatures.
Right now I have it such that a copy of this app is spun up any time a new PR is opened, and integration tests run against that copy. This copy gets its own webhook endpoint, but the events configured will be shared since it's currently done via IAC with Terraform.
So if I have branches fix/some-fix and chore/some-other-update both open with PRs, there will be one webhook endpoint for each branch, with each configured to listen to payment_intent.succeeded.
The goal is to be able to differentiate a payment_intent.succeeded event triggered by the automated tests on the fix/some-fix branch from the same type of event triggered by the automated tests on the chore/some-other-update branch.
In some cases I could use metadata, but a metadata hash doesn't appear to be available for all the event types I'm listening for.
The metadata is included in the event data. Do you have a event ID that I can take a look?
one second
"evt_1MZoYwPkS2isW7rh5IA2rVfa"
this event doesn't seem to contain any metadata, nor have any way of adding it.
And do you have the ID of the request that set a metadata?
the request that triggered that event?
I used stripe trigger from the CLI for that one.
stripe trigger account.application.deauthorized
I don't see you specify any metadata here.
because there's no field to specify the metadata on the object of the event.
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
that's the object.
can the event itself have metadata?
One sec, are you only interested in the account.application.deauthorized event?
no, there are multiple types of events I'm testing. I'm wondering if there's a generic solution to be able to differentiate between what triggered each event.
In some objects I can set metadata, like payment_intent.succeeded: stripe trigger payment_intent.succeeded --add payment_intent:metadata.test="local-test"
OK. The payment_intent has a metadata and you'll find it in webhook event if the metadata is set
yep, but what about for objects that don't support a metadata hash?
It really depends on what event you want to listen to. Most of the stripe objects has a metadata (https://stripe.com/docs/api/metadata#metadata)
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.