#qmathe

1 messages ยท Page 1 of 1 (latest)

high salmonBOT
molten folio
#

Hi ๐Ÿ‘‹

#

Unfortunately if you manuall trigger payouts you do not get the automatic association with payments

polar fable
#

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 ?

molten folio
#

To use the balance transactions list API I mentioned

polar fable
#

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?

molten folio
#

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

polar fable
#

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 ?

molten folio
#

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?

polar fable
#

yes exactly

molten folio
#

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

polar fable
#

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 ๐Ÿ‘Œ