#qmathe
1 messages ยท Page 1 of 1 (latest)
Hi ๐
Unfortunately if you manuall trigger payouts you do not get the automatic association with payments
You can use the Balance Transaction List API to filter the payments that are associated with each payout though
https://stripe.com/docs/api/balance_transactions/list
ok, I see.
What is the recommended way to deal with these sort of scenarios where a connected account is in charge of triggering its own payouts, while still providing him with a precise mapping between payouts and payments ?
To use the balance transactions list API I mentioned
ok, I was wondering whether another approach was available.
If I only offer to trigger a payout including payments older than 4 days, can I be sure that no payments will have a different availability delay that the one in my country (3 days in France) and end up being missing in the balance?
Or should I simply avoid to rely on this kind of assumption because it's unsafe?
I would not rely on that assumption
The Balance Transactions list is the best way to identify what payments have impacted the Stripe balance for an Account
Since every transaction that changes the account balance gets recorded there
So you could filter the list by the Payout ID and the type=payment to get the exact list of payments that were included
Makes sense ๐
To give you a bit more background, for the platform I'm working on, connected accounts can create zones and receive payments per zone, then they can trigger payout per zone. Since I cannot simply trigger a payout based on the whole available balance, because it represents the combined funds of several zones. How can I know the last payment I can safely include in a payout?
I'm setting a zone id metadata per payment, so do you think I could search the balance transaction list for the most recent payment with a matching zone id ?
So are you trying to come up with a way of identifying the valid paymets for a payout before you trigger that payout? To determine the amount?
yes exactly
Unfortunately there isn't a clean way to do this. You would filter the Balance Transaction list by type=payment and perhaps use the created parameter to define a time window: https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-created
Then loop over each Balance Transaction and use the source property to fetch the Payment Intent (or Charge) related and check the metadata on that object for the zone ID
ok, I'll give it a try then. It seems to be the only way to have something that could work reliably for my use case.
Thanks a lot, that was really helpful ๐