#tomfree
1 messages · Page 1 of 1 (latest)
Hi
Yes this looks a good start, you can make that API call in order to fetch events that weren't delivered:
https://stripe.com/docs/api/events/list#list_events-delivery_success
you can use your test environment in order to test this:
https://stripe.com/docs/testing
I am just using my sk_test ... api key and then doing the call but receive nothing. i.e. I know I just created such an event but I get However when print the result I get { object: 'list', data: [], has_more: false, url: '/v1/events' } i..el no events at all. Any idea what that is?
and 'setup_intent.succeeded' is among the types in my array of types of events I listen to and want to fetch
and limit is 100
let me see if i can get one
evt_1MbLThJgnOZBUP8aI74DcILh
develied to stripe cli (listen exe but not to my server - since i want to test exactly that case and just turned it on to get the id)
This event was delivered successfully, there isn't a failed delivery attempt
You need to have an event that its delivery status is failed, in order to get it from the API call you are doing above
well not really. it was delivered to stripe.exe but intentionally not to my server, since otherwiese I could not get it via the above call to handle missed events.
So I guess the question to my comes down to ho w can I know the eventId but without listening and accepting the event if a not delivery by stripe.exe is already considered successful delivery? Do youi know what I mean?
so how can I fail such an event
and still get its id
cause if i dont listen via stripe.exe at all then also ghe call gives no results, but obbiously I then have no id
You need to create a webhook endpoint in stripe, and your endpoint should be responding unsuccessfully (not 2xx), and the event should have failure delivery status
and if my system would be down in the event cannot be delivered at all would i then get it via this call?
Yes you will get it, but you need to have to register the endpoint in your Stripe Account
just realized my stripe cli registered as http://localhost:4000/api/stripe/webhook as webhook . does that do?
cause as as when the event is sent there I intentioanlly used a different port to get the eventid but not have it delivered to then call the missed event call
You need to register your publicly accessible HTTPS URL in the Stripe dashboard
You can't use your localhost endpoint.
You need to create a webhook endpoint in your stripe account:
https://dashboard.stripe.com/test/webhooks/create
is there a way to have different webhooks be called for prod and test data? I see can I also add webhooks via api which is nice for testing but I also of course want the events in production still be delivered so how can i have one webhook for productiona nd different webhooks for testing depending on test case?
and btw with the webhook now I see missed events. thanks
Yes you can have two endpoints types (test and live)
https://dashboard.stripe.com/test/webhooks/create
https://dashboard.stripe.com/webhooks/create
thanks. great. Have a beautiful day
Welcome!
one more thing.
I couldnt see a parameter int he api to create webhook to specify if it's for test or prod. Or does that happen automatically depdning on aoikey used?
i.e. sk_test... would always create test webhooks?
does that happen automatically depdning on aoikey used?
Yes.
thanks
Np!