#chhotisherpa_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/1215724318315511830
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hi đź‘‹
Do you see webhook events firing in your Dashboard logs?
If you do see webhook events, could you provide an ID? It will start with evt_
Yes I do and I have succeeded event and here is the ID: evt_1OrRP7PWLTGdTSvhQJPzCMyN
Thanks! Taking a look
Okay this event occurred on an Express account. The only webhook endpoint that it was sent to is a Connect webhook endpoint.
Yes correct
Okay so what is unexpected here?
So what I am trying to achieve is that once a user creates an express account and has gone through the onboarding process to setup a payout. Upon successful creation of a connected account, my user is then directed to the app where the event is triggered and a view payout page is displayed. But currently, that is not happening I am not receiving the event on my app when the user returns from the stripe dashboard.
and this is only happening in live mode. I am able to receive webhook events in test mode. I am confused of the behavior in the testing local environment and production environment.
Okay so the endpoint listed in the event you shared with me is your endpoing, correct?
yes it is
And for the event you shared, which is in Live mode, it was successfully delivered 6 times
yes
In order to understand what might be going wrong I would need an example of a webhook event that was not successfully delivered.
In the first webhook event that was not successful, I received HTTP status code : 404 because of the incorrect endpoint, and the second webhook I received HTTP status code : Timed out
Looking at those delivery failures, these all look like configuration issues for the server/code handling the webhook. The 404 and 400 responses are being sent by your server back to Stripe.
What was changed that resulted in the final event being delivered?
I changed the endpoint in the webhook dashboard to match the endpoint in my code
Okay, so has that addressed the issue?
I am having an issue where the successful webhook event is not being received in my app. I need the successful event to be sent to my app so that the database can be updated. Although the dashboard displays a successful event, I am not receiving it in my app.
which is only the case in live mode. in the testing local environment, I am able to receive stripe webhook events in my terminal and update the database correctly
I am having an issue where the successful webhook event is not being received in my app.
Do youy have an example of this? The only event you shared was successfully delieverd.
If you are referring to a front-end app, that is something your server side code would need to coordinate.
What you are describing in test mode is using the Stripe CLI and the stripe listen command. This is a utility used to help developers get started building webhook integrations but it isn't intended for production.
So based on this code from stripe: ```app.post('/webhook', express.raw({type: 'application/json'}), (request, response) => {
const sig = request.headers['stripe-signature'];
let event;
try {
event = stripe.webhooks.constructEvent(request.body, sig, endpointSecret);
}
catch (err) {
response.status(400).send(Webhook Error: ${err.message});
}
// Handle the event
switch (event.type) {
case 'payment_intent.succeeded':
const paymentIntent = event.data.object;
console.log('PaymentIntent was successful!');
break;
case 'payment_method.attached':
const paymentMethod = event.data.object;
console.log('PaymentMethod was attached to a Customer!');
break;
// ... handle other event types
default:
console.log(Unhandled event type ${event.type});
}
// Return a response to acknowledge receipt of the event
response.json({received: true});
});```
this is only intended for building webhook integrations in local testing environment? If so how are webhook event triggers passed to an app in production? Is there documentation for that?
No, I'm sorry if I confused you. The above code will work in production but the Stripe CLI that you run in the terminal is only for testing
But if you use the above code you need to make certain that the webhook endpoint you register points to this function
can I share my code here?
You already did, didn't you?
no that is an example from the stripe but I have a code similar to it. I am just trying to debug why I am not receiving real-time event data to my application’s webhook endpoint in my terminal when I am not using stripe cli.
I'm sorry but you still haven't shown me any events that you did not receive so I am having trouble figuring out how to help you
I am sorry I am confused as well. I just thought that when you have a successful event in the webhook dashboard and have registered webhook endpoints. Stripe would push real-time event data to my application’s webhook endpoint when events happen in your Stripe account.
The webhook endpoint you have set up is for Connected Accounts. It will only forward the account.updated event from your Connected Accounts.
If you wish to receive webhook events about your Stripe Acocunt, you will need to configure a different webhook endpoint that listens for events on your account.
when i meant stripe account would that be the business stripe account where all my connected accounts are?
even if I don't have an endpoint for Stripe account and just have an endpoint for the connected account shouldn't Stripe still send real-time event data to my application?
so to see the webhook data from the live mode do I need to create an endpoint for the platform account as well?
Depends on the event
If you want platform events you need a platform endpoint
Please read this doc: https://docs.stripe.com/connect/webhooks
It goes over the 2 types of webhook endpoints and explains the differences