#Durrell
1 messages · Page 1 of 1 (latest)
Hello! Yep, that sounds like a viable approach, although using a Connect Webhook Endpoint to listen for payment-related Events is what I would recommend instead: https://stripe.com/docs/connect/webhooks
what event would we listen for? I didn't see anything that we could listen for that would send us an event every time a BalanceTransaction record is created.
That's true, we don't have an Event for that, so if you wanted to know about every Balance Transaction your approach is probably best.
ok. thank you.
The flaw in this background job approach is I don't see a way to retrieve the account balance at the time the BalanceTransaction record was created.
That's correct, there is no way to do that. What you can do is retrieve the balance at a given point in time, then calculate the balance at a previous or later point in time by adding the Balance Transactions to it which happened before or after.
For example, let's say you get the balance on Jan 15 and it's $100. Then you get three Balance Transactions from Jan 1–14 which add $10, $20, and $30. You can subtract those values to get the balance on Jan 1st of $40.
Or, if you want to go forward in time, you add later Balance Transactions to the balance.