#ferb0000
1 messages · Page 1 of 1 (latest)
Hello ferb0000, we'll be with you shortly! Below are links to other discussions we've had with you in the past week in case you want to review that information. If your question is related to one of these previous discussions, please provide a comprehensive summary of the current state and what you need help with now. We help many users simultaneously, so a summary allows us to resolve your issue as soon as possible.
• https://discord.com/channels/841573134531821608/1164523952727658656, 0 days ago, 7 messages
• https://discord.com/channels/841573134531821608/1164511286860714125, 0 days ago, 10 messages
• https://discord.com/channels/841573134531821608/1163788928994775070, 2 days ago, 33 messages
Hey there, do you have a question about how this affects your integration that i can help with?
I just want to display to my user the the information along with a tooltip, to display what balance they have
and i am writing the tooltip, to describe what the pending balance is
I just want to know what makes up the pending balance
If you're using automatic payouts it kind of includes upcoming payouts, too, because stripe manages those automatically for you for optimal timing
But for manual payouts no it does not include that
Since those funds would need to have been available first
in the case where i am not using manal payouts, it should just be made up of ?
funds that arent available yet, most of which will already be earmarked to be paid out when available
You can list Payouts to see those for your connected accounts, too
And check their status: https://stripe.com/docs/api/payouts/object#payout_object-status
but doesnt that by definition mean that those funds will never be able to be paid out, as it is made up of pending payouts
No it means they are getting paid out automatically
So, yes, they may never go available because they get paid out right away with automatic payouts
tc.stripe ⬢ Available balances for account acct_1MqJIJPiNzptwsF5: {'gbp': {'true_available_balance': 0, 'stripe_pending_payout_data': 0, 'stripe_in_transit_payout_data': 0, 'stripe_available_balance': 0, 'stripe_pending_balance': 62400}}
i am logging this
and there is no pending payout data
so what else makes up this figure
If you want to see pending payouts, you need to look at payouts
account_balances = self.stripe.Balance.retrieve(stripe_account=account_id) or {'available': {}, 'pending': {}}
currency_balances = {}
# Iterate over the available balances
get_payouts = self.stripe.Payout.list(stripe_account=account_id)
for bal in account_balances['available']:
currency = bal['currency']
balance = bal['amount']
pending_payouts_amount = 0
in_transit_payouts_amount = 0
for payout in get_payouts['data']:
if payout['currency'] == currency and payout['status'] == 'pending':
pending_payouts_amount += payout['amount']
if payout['currency'] == currency and payout['status'] == 'in_transit':
in_transit_payouts_amount += payout['amount']
true_available_balance = balance - pending_payouts_amount
tc_logger.info('Pending amount for payouts on account %s: %s', account_id, pending_payouts_amount)
tc_logger.info('In transit amount for payouts on account %s: %s', account_id, in_transit_payouts_amount)
currency_balances[currency] = {
'true_available_balance': true_available_balance,
'stripe_pending_payout_data': pending_payouts_amount,
'stripe_in_transit_payout_data': in_transit_payouts_amount,
'stripe_available_balance': balance,
}
for bal in account_balances['pending']:
currency = bal['currency']
balance = bal['amount']
currency_balances[currency]['stripe_pending_balance'] = balance
tc_logger.info('Available balances for account %s: %s', account_id, currency_balances)
return currency_balances
true_available_balance = stripe balance - stripe pending payouts
stripe_pending_payout_data = payouts that have been created but are not yet submitted to your bank
stripe_in_transit_payout_data= payouts that have been submitted to your bank but are awaiting confirmation
stripe_available_balance = balance available to payout ??
stripe_pending_balance = ??
As you can see here, This is how i am getting the payout and balance data
this
The original issue, which continues to happen periodically is that sometimes we get a Payout creation error. i.e req_GzApoYjk4pDuOm
We have a button to inital a manual payout on our system. and currently use the true_available_balance and have tried just using avaiable balance before but get the same issue.
As a result we want to determin what the true make up of the Pending and Available Balances are, what factors effect them
You can't create manual payouts with using automatic payouts for exactly that reason, pending funds are allocated to payouts before they becomes available
To be clear, this is not fully scrutable to you
the pending balance is pending funds that havent settled yet
So we have automatic payouts to occur once per calendar month but also have a manual payout button, which we allow them to do once a month
with automatic payouts, some or all of that will have been allocated to payouts already
You can list the payouts via the api for the ones that are created, but some of them won't have been created yet
so do you think its the once that havent been created yet that cause this error
What error?
req_GzApoYjk4pDuOm
So for the payouts that havent been created, are they what make up the pending balance?
Yes, there is insufficient available balance to create a transfer, but with automatic payouts there never will be
yes, more or less. It's best to describe this just as pending funds, which includes any automatic payouts on the way and other pending funds to be paid out later
You won't be able to offer manual payouts unless you switch to manual payouts, then you can manage the "automatic" payout monthly yourself, but this will cause additional delay of pending funds to payout
(because you can only create the payout once the funds are available, while stripe does some optimizations here to start the automatic payout process while the funds are still pending)
Ok i have done some further research into our codebase and it appears that we both modify the stripe.Account payout settings['schedule']['monthly_anchor'] === having we use stripe to do automatic payouts
But we also
stripe.Payout.create ... to allow our users to create a manual payout (we limit to once per month)
2 -
as you mentioned that there are pending funds, made up from payouts that "aren't" yet created. and this will affect the ability for stripe to provide an accurate figure for us to calculate the "Real" available balance to offer a manual payout for.
3-
Above you mention that stripe does optimization which plays into the the time it takes for the "pending funds" to become usable payouts or balance
As out manual payout works periodically, I beleive that we could enforce a buffer of X hours or Days either side of their account set automatic payout date.
Yea ultimately you need to have sufficient available balance to be able to create a manual payout, so that's the only part that should matter when offering that option
Could please clarify exactly what you mean in detail. To each point above please 🙏
👋 hopping in here since synthrider needs to head out soon
I'm not sure what you need clarified with the first point, but for your 2nd point - yes, predicting the "real" available balance is deceptively tricky since you need to predict which of those available funds are being rolled into a pending payout. I think the manual payout should just work with available balance, but you'd probably want to test this out a bit more to be sure
For your third point, yes, I believe a buffer should help
regarding the 2nd point, we have tested and implement both using the available Balance in creating a manual Payout, and using (available Balance - sum pending Payouts) and continue to periodically get error Insufficient Funds. Therefore, I know that the available Balance doesn't work . i.e req_GzApoYjk4pDuOm