#bruce-zhang_webhooks

1 messages ยท Page 1 of 1 (latest)

cold gateBOT
#

๐Ÿ‘‹ 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.

warm muralBOT
brazen topaz
#

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.

pale rapids
#

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?

brazen topaz
#

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

pale rapids
#

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?

brazen topaz
#

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

pale rapids
#

So trigger event works like "fake" an event?

brazen topaz
#

Yes

#

So you can test and iterate quickly

pale rapids
#

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?

brazen topaz
#

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.

pale rapids
#

Understand. Thanks!