#jo07453
1 messages ยท Page 1 of 1 (latest)
Hello! We'll be with you shortly. Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
- jo07453, 1 day ago, 19 messages
hi! well the way it works is we send any event to all endpoints that you've set up to listen to that type of event
I don't really follow the exact problem you're having
ultimately Stripe only has two modes, live and test, so the two "local" and "test env" (or staging) environments you have can only map into the one test mode inside Stripe
Yes. But I would like not to have the local events to be fired to dev endpoint. Is it possible?
well not really no, if e.g.
-you do a payment in test mode
-that generates a charge.succeeded webhook event
-that event is sent to all test mode webhook endpoints on your account that listen to that event type
you just have to gracefully ignore things you don't recognise I would say (like return a HTTP 200 and do no further processing)
is there a way I can check to which the webhook is being answered to? So I could easily ignore the local events on dev env ?
Like a signature or something on the responses
How do people do it usually?
which the webhook is being answered to
I'm not sure what that means
the way it works is
- a
charge.succeededevent happens in test mode in your account - let's say you have two different endpoints http://local-proxy/webhook and http://staging.mycompany.com/webhook
- we send at the same time
- a HTTP request to http://local-proxy/webhook containing the
charge.succeededJSON and signed using the webhook signing secret for that endpoint - a HTTP request to http://staging.mycompany.com/webhook containing the
charge.succeededJSON and signed using the webhook signing secret for that endpoint
- a HTTP request to http://local-proxy/webhook containing the
the body of the HTTP request is identical
like I said, if you look at the data in the event and find that you don't recognise the ch_xxx charge ID for example, you can just gracefully ignore it since presumably it's not for that envionment
I get it. But is there a way I can the distinguish if the request was made by a local env so I can ignore it on dev? maybe using metadata?
I say that because if I ignore if not recognized the charge id (in you example) I may be neglecting the caught of an error on my platform that a charge id is not being saved and then I won't be able to catch that because I've ignored it
Does it make sense?
sure, you can pass metadata in the API request you make e.g. add it when you create the Charge and then see if that metadata is in the Charge object contained in the event
Is this the way most people do? I guess I am not the first person with this problem ๐
not really foolproof though since it heavily depends on how your integration works and what events you listen to (e.g. a lot of objects get created/updated automatically from some actions or hosted surfaces and are not triggered by direct API calls you make)
the other option is to use multiple Stripe accounts and the test mode of each account for your environments
I suspect most people use some combination of these approaches and sure yes, it's a common topic, like I said ultimately we only have the distinction between 'test' and 'live' on an account and more granularity has to be built separately unfortunately
Yes, this is definitly a topic where stripe can be improved. Anyway thanks a lot for you support ๐๐ป