#abd_payout-reconciliation

1 messages ยท Page 1 of 1 (latest)

ornate emberBOT
#

๐Ÿ‘‹ Welcome to your new thread!

โฒ๏ธ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).

โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260709066813079592

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

fallen rapids
#

abd_payout-reconciliation

#

Can you share an example Event id you are testing with? The evt_123

tranquil rock
#

sure

#

PayoutId : po_1PDG01PRgxGiFXI3yMtTgKZk

fallen rapids
#

That's a Payout id not an Event id

#

You are likely writing a webhook handler to receive Events from connected accounts as a Connect platform right?

tranquil rock
#

Here is the example evt id : evt_1PVnpKPRgxGiFXI3RYEPxd9w

#

i already have basic webhook handler , i know i will receive event when payout.paid triggers,
the only thing i want to do is to update my DB with staus as paid out .
but in my DB i will have 100 records that are waiting for update .
provider connect account might be credited with the amount but i want to know when that actuall got transffered to his back account.

fallen rapids
tranquil rock
#

the even i receive in the webhook is payout.paid. I am intrested only payout is happened or not.
Here is the code
public async handlePayoutsWebHook(request: { headers: { [x: string]: any }; body: string | Buffer }) {
const sig = request.headers["stripe-signature"];

let event;
try {
  event = this.stripeObj.webhooks.constructEvent(request.body, sig, this.endpointSecret);
} catch (err: any) {
  throw new APIError(`Webhook 'handlePayoutsWebHook' Error: ${err.message}`, 400);
}
let accountId: string | undefined;

// Handle the event
switch (event.type) {
  case "payout.canceled":
    const payoutCanceled = event.data.object;
    // Then define and call a function to handle the event payout.canceled
    break;
  case "payout.created":
    const payoutCreated = event.data.object;

    // Then define and call a function to handle the event payout.created
    break;
  case "payout.failed":
    const payoutFailed = event.data.object;
    // Then define and call a function to handle the event payout.failed
    break;
  case "payout.paid":
    const payoutPaid = event.data.object;
    // Then define and call a function to handle the event payout.paid
    break;
  case "payout.reconciliation_completed":
    const payoutReconciliationCompleted = event.data.object;
    // Then define and call a function to handle the event payout.reconciliation_completed
    break;
  case "payout.updated":
    const payoutUpdated = event.data.object;
    // Then define and call a function to handle the event payout.updated
    break;
  // ... handle other event types
  default:
    console.log(`Unhandled event type ${event.type}`);
}
return;

}

There no even object here that gives me connected account

fallen rapids
#

Sorry you just dumped code with no info

tranquil rock
#

sorry this is generic code from strip documentation

#

what i am trying to ask is , payout.paid event

#

will this have connectedAccountID ?

fallen rapids
#

yes all of them do

tranquil rock
#

ok , payout are usually for one or more payments correct ?
in that use case will will event have more than one connectedAccountId ? or payout are only for one connected accounts but multiple payments ?

fallen rapids
#

A Payout represents money moving out of a Stripe account's balance to their bank account at their bank. So a Payout is just for one specific connected account yes. So there would be account: 'acct_123456' on the Event
And yes a Payout can contain multiple separate payments and other transactions (Refunds, Disputes, extra fees, etc.)

tranquil rock
#

ok thank you so much for this info , one last question.
In my DB i m maintaing these feilds after i charge paymentIntent i.e connectedAccountId, paymentIntent id , chargeId amount and status as pending for now.
When my web hook receives payout.paid , i can get connectedAccountId and payments but is there a easy way to map back to my db record,
connectedAccountId will give me back multiple rows from DB. Is there a way to get the paymentIntentId or chargeId in web hook?

fallen rapids
#

The way you know what is inside a Payout is by using the List BalanceTransactions API and passing payout: 'po_123' so that it gives you all the "money movements" (what we call BalanceTransaction) grouped in that Payout. See https://docs.stripe.com/expand/use-cases#charges-in-payout which explains this in details.

For Stripe Connect it's similar but you make the call on the connected account where the Payout/BalanceTransactions live so you use the Stripe-Account header: https://stripe.com/docs/connect/authentication#stripe-account-header

tranquil rock
#

Thank you sir, u saved my day. Let me try out this .
hope fully i wll be able to trigger payout event from stripe cli to test it. I n prod i know payout are created by stripe and events are sent

fallen rapids
#

unfortunately none of this can be tested ๐Ÿ˜ฆ

#

You have to wait for a real Payout to happen on that connected account which takes days

tranquil rock
#

instant payout will also not work in test env ?

#

30 mins right ?

fallen rapids
#

You are trying to do Payout reconciliation. That only works with automatic Payouts, the ones we calculate and create daily.
If you use manual Payouts or Instant Payouts, you tell us "please send $127 USD" so we don't know what is included in that Payout, only you would know so there's no reconciliation for those

tranquil rock
#

ahh i see that, ok . will wait for real payout to happen.
Thank you so much , u r awesome

fallen rapids
#

happy to help!

tranquil rock
#

bhe

#

bye