#td3_webhooks

1 messages ยท Page 1 of 1 (latest)

humble pilotBOT
#

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

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

open shadow
#

๐Ÿ‘‹

#

Do you have the id of the Webhook endpoint in question?

zinc rover
#

destination id:

ed_61U5tOORqeQ3kNXMz16RxsG735SQnrGCANkTmcC8e5E8

open shadow
#

Destination ID should start with we_

zinc rover
#

weird this one doesn't

#

my other webhooks do start with we_

#

I set this one up the same way i did the others in the dashboard

open shadow
#

I'm going to send you a DM with a link that will request consent for us to look at your account and available account objects which will allow me to investigate this issue better.

zinc rover
#

ok

open shadow
#

do you have an account ID handy?

zinc rover
#

yes one sec

#

acct_1QoUIkB6Rd28slYr

humble pilotBOT
#

Hello @zinc rover, we have sent you a direct message, please check it at https://discord.com/channels/@me/1468020878964166847

  • ๐Ÿ”— The message has instructions on how to grant read and write access to your Stripe Dashboard for our Developer Support team, in order to help you more effectively.
zinc rover
#

i approved

open shadow
#

Ty! Looking into this.

open shadow
#

Attempting to reproduce end to end, appreciate your patience.

zinc rover
#

router.post('/webhook', async (req, res) => {
// Since we used express.raw() middleware for this route,
// req.body is already a Buffer
const relevantEvents = new Set([
'v2.core.account.closed',
'v2.core.account.created',
'v2.core.account.updated',
'v2.core.account[identity].updated',
'v2.core.account[requirements].updated',
]);
const sig = req.headers['stripe-signature'];
const webhookSecret = process.env.STRIPE_WEBHOOK_SECRET_PLAYFUL;
let event;
try {
if (!sig || !webhookSecret) {
return res.status(400).json({ error: 'Webhook secret not found.' });
}
event = stripe.webhooks.constructEvent(req.body, sig, webhookSecret);
console.log(๐Ÿ”” Webhook received: ${event.type});
} catch (err) {
console.log(โŒ Error message: ${err.message});
return res.status(400).json({ error: Webhook Error: ${err.message}, event: event });
}

#

if (relevantEvents.has(event.type)) {
try {
switch (event.type) {
case 'v2.core.account[requirements].updated':
const account = event.data.object;
await manageAccountNeedsImmediateAction(account.id, account.requirements);
break;
case 'v2.core.account.closed':
case 'v2.core.account.created':
case 'v2.core.account.updated':
case 'v2.core.account[identity].updated':
await manageAccountStatusChange(event.data.object.id);
break;
default:
throw new Error('Unhandled relevant event!');
}
} catch (error) {
console.log(error);
return res.status(400).json({ error: 'Webhook handler failed. View your Next.js function logs.', event: event });
}
} else {
// Unsupported event type - log but return success to prevent Stripe retries
console.log(โ„น๏ธ Unsupported event type received: ${event.type});
return res.status(200).json({ received: true, message: Unsupported event type: ${event.type} });
}
return res.status(200).json({ received: true });
});

#

that's my nodejs webhook fyi^

open shadow
#

Ok, can you do me a favor and create a new endpoint destination.

Instead of selecting "Connect and V2 accounts", select "Your account" (counter intuitive I know)

Then down below where you select what events to listen to. Check "accounts v2"

You can refer to the Screenshot.

After the end point is created. try resending one of the v2 account events and it should show up in the newly created end point.

zinc rover
#

ok doing it now

humble pilotBOT
zinc rover
#

yea it works now, the events are being delivered

#

thank you

#

resolved

open shadow
#

Ok, this next part is totally optional, but it might be worth reaching out to support to voice feedback relating to how counter intuitive this flow is.
I would think most people would end up in the same situation you did given the way the information is presented. (I know I did)

zinc rover
#

haha yea