#NewtReyes

1 messages · Page 1 of 1 (latest)

proven notchBOT
errant wren
#

Hey there

#

But there is no way to do this directly... you have to deduce it based on the above

#

And then the remaining have not been paid out yet

#

But that's pretty inefficient

olive sleet
#

Mmmmm

errant wren
#

Not without doing a similar thing to what I discussed above

#

It sounds like really what you want is to cache this data yourself

#

So each time a payout is made you list the balance transactions for that payout

#

And store it

#

Then you can always compare to that

olive sleet
#

Nice idea

#

Interesting

#

Is there a way to receive a webhook whenever a balance transaction is created?

errant wren
#

But not hook for every BT

olive sleet
#

So, here's what we are trying to achieve: we would like to make sure an external system is in sync with the information on the Stripe side.

For that, we are already listening to the payouts so we make sure all balance transactions included in the payouts are present and correct in the system.

But sometimes, the available balance in the external system is different from the one Stripe shows. So, we want to review all balance transactions that add up to the available balance that Stripe shows us so that we can auto correct any issues this system may have.

#

Based on your idea, if we could cache all balance transactions that are created for a specific connected account, then when a payout is generated we could remove the payout balance transactions from the list that we have cached. That should give us all balance transactions that have not been included yet.

errant wren
#

Yep that's what I'd do

olive sleet
#

But we still need to figure out how to cache all the balance transactions that are created since there is no webhook that notifies us of that.

#

We will have to listen to lots of webhooks to cache them all.

#

Am I missing something?

errant wren
#

In this case I think you just want to poll your server here

#

Instead of using webhooks

olive sleet
#

But I need to populate the balance transaction list in my server

#

How can I do that?

errant wren
#

So basically you retrieve balance via the API when you display this balance in your external system.

#

If that balance doesn't match, you list balance transactions

#

And then update your cached list

#

If you want to keep that cached list more up-to-date then you could update the cached list each time there is a payout.paid

olive sleet
#

Sorry if I am missing your point

#

I am really trying to understand

errant wren
#

Let's back up one sec to the root cause here

#

How are you calculating the available balance in your external system to begin with?

#

Like why is it not in-sync?

olive sleet
#

Here's what we were doing: every time a new payout was generated, we retrieved all the related balance transactions and made sure that the system had all the required information to back those balance transactions with payments, refunds, disputes, transfer reversals, etc. At that point, if anything was out of sync, it got automatically synchronized.

That allows us to make sure the system is in sync up to the last balance transaction that was included in the last payout.

#

Now, we still need to do the same for any transaction that has not yet been included in a payout.

#

So, we need a way to retrieve those balance transactions so that we can perform the same process on those.

#

Does that make sense?

errant wren
#

Yes it does

olive sleet
#

Now, if I go back to your idea: if we could cache all balance transactions on our side and then remove the ones that are included in a payout (by mean of the payout.paid webhook), then we would be able to do that

errant wren
#

Right

#

So this goes back to needing to list

#

And then comparing

olive sleet
#

Correct

errant wren
#

Okay

#

So your question is how far back should you list

olive sleet
#

Yes

errant wren
#

That mostly depends on the different payment methods that you are using

olive sleet
#

right

errant wren
#

For how long from when the BT is created until it would be available

olive sleet
#

And what about this: Could we use the balance.available webhook to know when a new balance transaction is available?

errant wren
#

No, it fires when your funds become available each day

#

Not each time a new BT is created

olive sleet
#

Got it

#

what about retrieving 2 days of transactions every day and remove the ones that are already included in a new payout when a new one is available?

errant wren
#

Sooo also, why are you focused on the BTs?

#

Why not just retrieve the balance itself?

#

Because you want to show the BTs?

errant wren
olive sleet
# errant wren Why not just retrieve the balance itself?

BTs allow us to see if we are missing any piece of information in that external system. Ex. We receive a balance transaction for a charge and that charge is not in the system or it is out of sync. Then we trigger a synchronization for that charge (called payment in the external system)

errant wren
#

Okay so this isn't about a UI here, then?

olive sleet
#

Correct. It's about keeping an external system in sync with Stripe

#

We are using the Stripe balance to detect when the 2 are out of sync.

#

We are also using the payouts, but that only allows us to sync up to the last transaction included in the last payout.

olive sleet
errant wren
#

Okay okay okay

#

I thought this was about an external system UI that you wanted to show available balance

#

This is way easier then and you just poll like you were saying

#

Run it each day

#

And then run it if you need to sync

#

By "run it" I just mean List balance transactions via the API

#

And update your internal data

#

If you need to sync it outside this regular runtime, you just list BTs since the last time you listed them