#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/1217653968755232808
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- bruce-zhang_api, 5 hours ago, 15 messages
Yeah your scenario totally makes sense to me. Stripe have Live mode and Test mode, which you can use for Production and anything other including Staging respectively
Do you mean that when I create an endpoint like this in test mode, then the webhook endpoint is for test mode? And if I turn test mode off and create an endpoint, then the endpoint is for real production environment
Yes correct
If I run staging to test on http://localhost:3000/ and my webhook listener is on http://localhost:3000/webhooks, what I need to do is to paste http://localhost:3000/webhooks to the Endpoint url, is that correct?
No that's not correct because localhost is not public over the internet
You want to put to Stripe Dashboard public URL via some hosting provider
If you just want to test, you can use service like ngrok.io
Yes that's the purpose of the forward command
You can forward events to your localhost, the same machine that you runs CLI
Thanks. Can i get the customer ID from the webhook?
depends on the event but generally yes
I think I get get it from the first case. If I am using a webhook to listen to the checkout session, and the user subscribes to a plan, then both 'customer.created' and 'customer.subscription.created' event will happen. How can I make the webhook handle both cases?
It's totally up to you! You can decide to handle in one of these events
I mean handle multiple events. Will the stripe webhook send two events to me at the same time?
Yes, it is the nature of webhook events. It's the Customer also created, and that Customer's Subscription also created at the same time
In this switch case, it seems that only one type of event will be handled at one time. How do handle both customer and customer's subscription at one time?
No you can't. That's the nature of async event handling. You want to think of an async way of process both the event. ie. When you receive customer.created simply save to database, but when customer.subscription.created you can call an API to Retrieve the Customer (and make it retry with some ponential backoff strategy) until you get the customer