#Sonnyshot-OpenAPI
1 messages · Page 1 of 1 (latest)
yup, the enabled_events is an array of strings https://stripe.com/docs/api/webhook_endpoints/create?lang=curl#create_webhook_endpoint-enabled_events
Can you share how you made the requests?
you will have to use different syntax for Postman
but this is how i would expect to make the request
i've also made the requests using javascript axios or python requests
is it not possible to have an array in the body like {"enabled_events":["invoice.created", "account.updated"]} ?
yeah, here you've selected URL-form-encoded type in which the syntax of passing the array parameter is
curl https://api.stripe.com/v1/webhook_endpoints \
-u sk_test_xxxxx: \
-d url="https://example.com/my/webhook/endpoint" \
-d "enabled_events[]"="charge.failed" \
-d "enabled_events[]"="charge.succeeded"
this will just be the syntax required
can you try add [] in the event_types in POSTMAN
and see if it works?
this works for me
right, i get that that works, but I guess my question was more about the use of event_types as a property of type array in the OpenAPI spec
hmm that was not the formatting i was going for lol
In languages like Python, you can use the regular syntax. For example
stripe.WebhookEndpoint.create(
url="https://example.com/my/webhook/endpoint",
enabled_events=[
"charge.failed",
"charge.succeeded",
],
)
javascript
const webhookEndpoint = await stripe.webhookEndpoints.create({
url: 'https://example.com/my/webhook/endpoint',
enabled_events: [
'charge.failed',
'charge.succeeded',
],
})
right, underneath it, the above was translated to an HTTP call with encoded with form-urlencoded format which is like this
-d "enabled_events[]"="charge.failed" \
-d "enabled_events[]"="charge.succeeded"
that is still an array, it is just a standard you will have to follow
gotcha, so for form-urlencoded bodies, it has to be send in that way
i guess that was more of me not understanding the standard than a specific issue with Stripe but I appreciate the help all the same!
np good luck.