#Ferb
1 messages ยท Page 1 of 1 (latest)
paid
the inital response from creating the payout states it is in_transit, however if I payout.list() the payout is paid
?
Sorry for the delay. Having a look now.
So I managed to reproduce: the payout is first in_transit and then immediately moves to paid in test mode. You would like the payout to stay in_transit longer? Why?
Because, I want to get the available balance for a client, which i have setup like this in my code
def get_available_balances(self, account_id: str):
"""
Getting the available balances from the account per currency. This is the amount that can be transferred to the
bank account associated with the stripe account is calculated by subtracting the amount of any payouts in
transit.
"""
account_balances = self.stripe.Balance.retrieve(stripe_account=account_id) or {'available': {}}
currency_balances = {}
# Iterate over the available balances
for bal in account_balances['available']:
currency = bal['currency']
balance = bal['amount']
payout_amount = 0
get_payout = self.stripe.Payout.list(stripe_account=account_id, status='in_transit')
for payout in get_payout['data']:
if payout['currency'] == currency:
if payout['status'] in ['in_transit', 'pending']:
payout_amount += payout['amount']
true_balance = balance - payout_amount
if true_balance != 0:
currency_balances[currency] = true_balance
tc_logger.info('In Transit amount for payouts on account %s: %s', account_id, payout_amount)
tc_logger.info('Available balances for account %s: %s', account_id, currency_balances)
return currency_balances
this works,
however I would like to create a test which has a payout with payout status to ensure it works
If you managed to create a payout and it has a paid status, it means that it did work, no?
in my unit test, I want the status of the payout to remain pending or in_transit, so that it is caught (and not included) in my get available balances
Having a look to see if it's possible.
thanks ๐
๐ taking over for my colleague. Let me catch up.
I'm not sure we have this possibility in test mode based on this https://stripe.com/docs/connect/testing#account-numbers
sure you can contact https://support.stripe.com/?contact=true they will relay the feedback to the internal team and keep you posted if/when we might do it
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.