#donna-j_webhooks

1 messages ยท Page 1 of 1 (latest)

surreal vectorBOT
#

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

๐Ÿ“ 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.

mighty crane
#

This is the newly created webhook and we have updated the keys and stripp signature both in local and Cloud run.

#

I did trigger a payout which was successful but unable to see it here..in the screenshot.

bold summit
#

Hi! Can you paste the webhook ID (starts with we_) here please?

mighty crane
#

sure..

bold summit
#

Also can you paste the payouts event ID you tested here as well.

mighty crane
#

we_1SPabgIq2bf80JUVq6Ul8Sj4

#

this is the destination id.

#

the payout test event id=po_1SPafpETItnpyqT5EUL7Snzc

#

this is the code in local for webhooks:interface StripeWebhookRequest extends express.Request {
body: Buffer;
headers: {
[key: string]: string | string[] | undefined;
'stripe-signature'?: string;
};
}

export function setupStripeWebhook(app: express.Application) {
app.post('/api/stripe/webhook', express.raw({ type: 'application/json' }), async (req: StripeWebhookRequest, res: express.Response) => {
const sig = req.headers['stripe-signature'];
const endpointSecret = process.env.STRIPE_WEBHOOK_SECRET;

if (!endpointSecret) {
  console.error('[Webhook] STRIPE_WEBHOOK_SECRET not configured');
  res.status(500).send('Webhook secret not configured');
  return;
}

let event;

try {
  event = stripe.webhooks.constructEvent(req.body, sig!, endpointSecret);
} catch (err: any) {
  console.error('[Webhook] Webhook signature verification failed:', err.message);
  res.status(400).send(`Webhook Error: ${err.message}`);
  return;
}

console.log(`[Webhook] Received event: ${event.type}`);

try {
  switch (event.type) {
    case 'payment_intent.succeeded':
      await handlePaymentIntentSucceeded(event.data.object);
      break;
    case 'payment_intent.payment_failed':
      await handlePaymentIntentFailed(event.data.object);
      break;
    case 'payout.paid':
      await handlePayoutPaid(event.data.object);
      break;
    case 'payout.failed':
      await handlePayoutFailed(event.data.object);
      break;
    default:
      console.log(`[Webhook] Unhandled event type: ${event.type}`);
  }
} catch (error) {
  console.error('[Webhook] Error handling event:', error);
  res.status(500).send('Webhook handler error');
  return;
}
res.json({ received: true });

});
}

bold summit
#

The webhook you created is for events on your own account. Th epayout event will appear on your connected account. So to listen for events on your connected account you will need to create a new Connect webhook: https://docs.stripe.com/connect/webhooks

Learn how to use webhooks with Connect to be notified of Stripe activity.

#

I would suggest testing your current webhook with an event on your own account. Like a successful payment for your account.

mighty crane
#

alright got it..the webhook that is created is only for my app account and not for the connected accounts.

#

So the one that I'm did now was an account webhook..

#

not a connected webhook

bold summit
#

Yeap!

mighty crane
#

Thanks again. I did go through the docs shared. Is there any other doc related to connected account webhook that would give us the steps to setup the connect webhook.

#

Both the webhooks seems to have the same steps.

bold summit
#

These are our main docs and the set up process is the same except for the connect type.

#

Have you tested the webhook you just created?

mighty crane
#

The webhook that is created with destination id=we_1SPabgIq2bf80JUVq6Ul8Sj4 is the account webhook, but what do I do to get this connected account webhook set up.

mighty crane
#

req_xIO6CUFPUOuGCg

#

this is the request id and this is shown.

#

I wanted to see the how a payout would work for a connect account and really don't know what changes are to be made in the dashboard to enable this.

#

I did try creating a webhook for connected account and I'm not sure I did the right one.

surreal vectorBOT
mighty crane
#

this is the event that was triggered :evt_1SPbVCETItnpyqT5cAKzZBPu

bold summit
#

You will need to create a new webhook for your connected account events.

#

I did try creating a webhook for connected account and I'm not sure I did the right one.
Can you share the webhook ID for us to check?

mighty crane
#

Yes, I did create a new webhook for connect accounts.. I did test for acct_1SOJDRETItnpyqT5

mighty crane
#

I think I 'm in the right track.

#

Now, this is how I see the events but it seens there's a 400 Request code:

stiff oriole
#

hi there ๐Ÿ‘‹ taking over the thread from my colleague, give me a moment to catch up

mighty crane
#

sure...

#

Thanks again.

stiff oriole
#

Based on the event logs for we_1SPbSvIq2bf80JUVmsSAtrY1, it looks like you're seeing webhook signature verification errors like the screenshot you share above.

mighty crane
#

That nice. I will take a look at this doc and get back.

#

Thanks again.