#bruce-zhang_webhooks
1 messages ยท Page 1 of 1 (latest)
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1225573612187287643
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi ๐
Can you clarify what you mean by
I want to figure out how the webhook will work at local/cloud and live/test mode.
We allow thorough testing in Test mode so you can be certain how your integration will behave.
We have a section in our docs here: https://docs.stripe.com/webhooks#test-webhook specifically focused on how you can test your webhook handling code locally
I want to know how the webhook works. For testing locally, I will use stripe CLI to send out event and my webhook can receive it, is that correct?
You want to use two instances of the Stripe CLI
In one console you run stripe listen --forward-to=http://localhost:4242/webook or whatever your host is
In the second console you run stripe trigger event.name
The first process forwards all webhook events from your account to your local development
The second one triggers a webhook event so you can receive it
Do I have to trigger a event manually? For example, if a payment finished, some events should be sent by stripe. In this case, should I still trigger the event manually to send an event to my local machine?
You don't have to, you will still get the events when a payment completes
But the CLI methods are created to help you test your integration. So you can use it to trigger an event and test how your webhook handling code behaves
So trigger event works like "fake" an event?
Got it. Thanks
I am also curious how the webhook work in production environment. In production, we use live mode instead and there will not be a CLI to forward the events to the webhook. In this case, how will my webhook receive events from stripe?
In that case you register a Webhook Endpoint either using the Stripe Dashboard or the API as we describe here: https://docs.stripe.com/webhooks#register-webhook
This will include the publicly accessible URL where we will send webhook events based on what events you are listening for.
Understand. Thanks!