#rehan_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/1291367258777452606
๐ 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.
- rehan_connect-account-capabilities, 19 hours ago, 90 messages
no
i have webhook which will trigger when payout.paid evnet occur but in body i am getting account id
is there nay way i can get stripe sesssion id when the webhhook payout.paid is trigereed
by 'session id' what are you referring to? a CheckoutSession ID cs_xxx?
currently my system is design like when houseonwer post the job i store stripe session id. Multiple shoveller can apply for the jobs so when shovelelr completed the job i need to pay him. and change the status to paid for the particular shoveller.
seee the stripeSeeionId
so the answer is 'yes', got it
well yes, you can get that ID. But first, to clear, a payout bundles multiple payments, a single payout can be 100s of charges for example. It's not a one-to-one mapping.
so the first step is to take the payout and reconcile it to the charges it contains : https://docs.stripe.com/expand/use-cases#charges-in-payout . Once you've done that there are ways to then find the related CheckoutSession for a given charge.
f (event.type === 'payout.created' || event.type === 'payout.paid' || event.type === 'payout.failed' || event.type === 'payout.updated') {
const payout = event.data.object;
const stripeAccountId = payout.id //get stripe account id
let payoutStatus;
switch (event.type) {
case 'payout.created':
payoutStatus = 'created';
break;
case 'payout.paid':
payoutStatus = 'paid';
break;
case 'payout.failed':
payoutStatus = 'failed';
break;
case 'payout.updated':
payoutStatus = 'updated';
break;
default:
payoutStatus = 'unknown';
}
can you please tell what i will get const payout = event.data.object;
if i consoel.log(payout)
you get a Payout object.
in the payout object i will get account
i need session id
does this payout obect contain session id ?
checkout seeiohn id?
please read my previous replies where I answered this.
i didnt get your previosu reply not ablt to understand can you please elborate
?
what part can I elaborate on specifically?
how can i get sesiion id if in the payout object?
You don't get it from the Payout object itself.
To clear, a payout bundles multiple payments, a single payout can be 100s of charges for example. It's not a one-to-one mapping.
so the first step is to take the payout and reconcile it to the charges it contains : https://docs.stripe.com/expand/use-cases#charges-in-payout . Once you've done that there are ways to then find the related CheckoutSession ID for a given charge.
const payoutId = 'payout_xxx'; // The payout ID you receive from the event
const charges = await stripe.charges.list({
payout: payoutId,
limit: 100, // Get up to 100 charges
});
charges.data.forEach(async (charge) => {
const paymentIntentId = charge.payment_intent;
const paymentIntent = await stripe.paymentIntents.retrieve(paymentIntentId);
const checkoutSession = paymentIntent.metadata.checkout_session_id; // Assuming you stored it in the metadata
console.log('Checkout Session ID:', checkoutSession);
});
will this work
?
isn't it what your are saying
will this work
you could try it in testmode and see what happens!
but no, that won't work, there is no such thing as a payout filter on charges.list, not sure where you got that from. The docs I linked show clear example code for this.
okay let me check the docs
Karlleko Docs are always confusing for me
can you help me to give me the code
?
please try it in test mode and see what it does.
okay let me try