#testDeveloper

1 messages · Page 1 of 1 (latest)

fading jackalBOT
tired frost
#

hi! No. I don't think there's any situation where you would only have a ba_xxx ExternalAccount ID and not already know the account ID acct_xxx it's related to. What is the context of your questiom?

dusk plank
#

i am performing a trace back to transfers from payouts of external accounts

#

so require somehow connected account Id from payout object or another related link or something

tired frost
#

you already know the ID since you needed to pass Stripe-Account when calling the /v1/payouts API to access the Payout object.

dusk plank
#

no thats where i require the id

#

i am doing it in the case of event

#

payout.paid

#

and there i only have the payout object and external account Id

#

is there any way to know payout was of which connected account?

tired frost
#

there's an account field in the webhook for payout.paid

#

In addition to the documented response properties in the event object reference, each event for a connected account will also contain a top-level account property. It identifies the user for whom the webhook is being sent.

dusk plank
#

will the old events be triggered to newly created webhook ?

tired frost
#

no

dusk plank
#

but still getting an error

tired frost
#

are you using the right signing secret whsec_xxx?

#

to debug this you'll need to add logging to log every value you pass to constructEvent (the payload, the secret, and the signature header) and then we can try to have a look at what part is wrong

dusk plank
#

now i am not getting the failure error

#

but the event switch case is not working

tired frost
#

can you say more about it "not working" exactly?

dusk plank
#

no logs for events that i defined inside the switch case

tired frost
#

could you share the exact code and which part is not working?

#

and an event ID evt_xxx that is triggering the problem

dusk plank
#

switch (event.type) { case 'payout.created': await TransactionModel.findOneAndUpdate( { transactionId: event.data.object.balance_transaction }, { payoutDate: new Date(new Date(0).setUTCSeconds(event.data.object.arrival_date)) }, ); console.log('payout', event.data.object.created); break; case 'transfer.created': console.log('transfer', event.data.object); console.log('transfer.createdDate', new Date(new Date(0).setUTCSeconds(event.data.object.created))); break; case 'payout.paid': console.log('event', event); const retrievePayment = await StripeService.BalancePaymentTransactionList( { payoutId: event.data.object.id, stripeAccount: event.account }, ); console.log('retrivePayment', retrievePayment.data); const paymentIds = retrievePayment.data.map(payment => payment.source); console.log('paymentIds', paymentIds); await TransactionModel.updateMany( { paymentId: { $in: paymentIds } }, { $set: { payoutDate: new Date(new Date(0).setUTCSeconds(event.data.object.arrival_date)), }, }, ); console.log('payout.paidDate', new Date(new Date(0).setUTCSeconds(event.data.object.arrival_date))); break; case 'charge.succeeded': console.log('charge_success', event.data.object); console.log('charge.succeededDate', new Date(new Date(0).setUTCSeconds(event.data.object.created))); break; default: // Unexpected event type console.log(Unhandled event type ${event.type}.); }

tired frost
#

thanks

#

and an event ID evt_xxx that is triggering the problem?

#

for example, you said earlier you are using payout.paid

#

but that code only looks for payout.created

dusk plank
#

its being triggered but after endpoint check nothing works

#

no logs

#

i suppose code execution stops after that

tired frost
#

possibly, hard for me to say really, I don't have access to your code