#zaq_payouts-balance-transactions
1 messages ยท Page 1 of 1 (latest)
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.
- zaq_unexpected, 14 hours ago, 19 messages
- zaq_webhooks, 21 hours ago, 9 messages
- zaq_unexpected, 1 day ago, 13 messages
- zaq_connect-sct, 1 day ago, 7 messages
๐ Welcome to your new thread!
โฒ๏ธ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
โฑ๏ธ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
๐ This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1236013594630684673
๐ Have more to share? Add more details, code, screenshots, videos, etc. below.
now we just want to trigger a payout for the remaining balance of that charge
So are you saying you transfer some portion of the funds to a Connected Account?
Can you share the ID of an example charge? When you say payout are you referring to funds coming from your Stripe account into your external bank account?
sure!
so we have this latest_charge of: ch_3PCBfsE1o3vQgPLo15JL6dAc
on our paymentIntent of pi_3PCBfsE1o3vQgPLo1uk0gFXv
and then we successfully did a transfer of tr_3PCBfsE1o3vQgPLo1XYWCzXU
and yes, we're trying to automate a payout from our stripe account to our external bank account for the remainder of each charge we receive from our customers after the transfers to our third party business partners
That would depend on whether or not it is available in your Stripe balance
yeah, but what is the best means of automating this? if we have a successful paymentintent, is there a delay before those funds are in our stripe balance?
There is, just let me collect some details so I can explain it directly with this charge
Okay so this is a little more tricky because of the Separate Charge & Transfer flow.
yaaaa, i needed to put metadata on the transfers, so i had to split them apart from the charge
Gotcha. Okay I'm looking at the two Balance Transactions associated with the Charge and the Transfer
What I would do is, check the available_on time stamp: https://docs.stripe.com/api/balance_transactions/object#balance_transaction_object-available_on
And use that to determine when both have settled and your Stripe balance properly reflects both actions
Then you can either calculate the amount or make another API call https://docs.stripe.com/api/balance/balance_retrieve to get your available balance https://docs.stripe.com/api/balance/balance_object#balance_object-available and determine how much to generate a payout for
the available_on isnt part of the paymentIntent object though is it?
No, it's specific to the BalanceTransaction because that's the lowest level object that records any transaction that impacts your Stripe balance
does the balanceTransaction have a chargeId associated with it so i can link it to a user's payment?
or a source_transaction or something
Yup, that is the source parameter when type='charge' https://docs.stripe.com/api/balance_transactions/object#balance_transaction_object-source
It's expandable so you can pass expand=['source'] or expand=['data.source'] for Retrieve and List APIs respectively
okay. so, i just want to make sure i follow.
when we have a paymentIntent with a status of 'succeeded' message that hits our server through a webhook we setup. we can request a balanceTransaction from stripe via something like
const balanceTransaction = await stripe.balanceTransactions.retrieve(transactionId);
and then from the available_on data we can find out WHEN we can then initiate a payout?
but there's no way to recieve a message via webhook automatically when the funds are available in our account related to any specific charge?
Well... you could try listening to the balance.available webhook event https://docs.stripe.com/api/events/types#event_types-balance.available
I haven't tested that to see how noisy it is but that could be another approach and would mean you don't have to do all the calculations yourself
just to clarify,
the balance.available message just tells us when a certain amount of money is available in our account, but not the original charge it comes from correct?
Correct
So if you wanted to link it back to the specific payment, you still would need to take the Balance Transaction approach
okay cool. let me talk to my team about what method makes the most sense for us. thank you for the clarification though!!!
Happy to do it! ๐ I hope one of those options works out for you ๐