#sebastian_api
1 messages ¡ Page 1 of 1 (latest)
đ 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/1293194276200644630
đ Have more to share? Add more details, code, screenshots, videos, etc. below.
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.
- sebastian_api, 18 hours ago, 68 messages
- sebastian_webhook-testing, 20 hours ago, 34 messages
- sebastian_api, 21 hours ago, 17 messages
The status of a payout but also of the transfer leading to the payout. So my company will have all the money on my Stripe account. I will then conduct transfer actions programmatically to each vendor's connect account. Once the money is in their account, I would like to monitor the payout. If the process to do this requires manual payouts, then Im game.
a Transfer object doesn't have a status. but you could listen to the balance.available on the connected account.
or the payouts, you can see all webhooks events that are sent about it: https://docs.stripe.com/api/events/types#event_types-payout.canceled
you could also check the BalanceTransaction of the Transfer to get more information
So if I were to listen to the balance.available event I would get a payload similar to this:
you would get a Balance object, yes
If I inspect the source_types, I get this:
Is there some unique identifier I can use from the availibility of a balance so I can always go back and reference it.
Because the idea is to have this action saved on my DB to keep track on what part of the journey the payment is on
Hey there, just stepping in as my colleague needs to head out
youre good bud
There's no unique identifier for the balance available events, no. However, if you're making manual transfers from your available platform balance there's really no need ot track anything, that happens immediately.
the availability i only delayed where the source funds are still pending (not available)
Ok so my final thing here is that the balance object when it shows all available balances, it doesnt show a unique ID about it.
Just the presence of the amount and how it was paid really.
Not even a timestamp to set it apart from other txs
the timestamp is the event timestamp
but taking a step back, you're trying to follow these transfers/payments through payout lifecycle, right?
Correct. If you could just steer me on the best approach here, I would appreciate.
Just basically giving the user 3 steps
Funds awaiting payout, payout in process, and paid
You're going to want ot focus on the payouts, listening for payout creation each day
then you can back-reconcile the transfers included in each one:
https://docs.stripe.com/expand/use-cases#charges-in-payout:~:text=If youâre using Connect
Using BalanceTransactions, you list by payout and use expansion to load reference objects to get back to the transfer
curl https://api.stripe.com/v1/balance_transactions \
-u sk_test_123: \
-d payout=po_456 \
-d type=payment \
-d "expand[]"="data.source.source_transfer" \
-H "Stripe-Account: acct_789" \
-G
Then you can record those transfer<>payout mappings in your own system
and focus on the payout state
the payout object, after its created
You'd listen for payout.created after some un-reconciled transfers and work backwards to see what that payout includes
Not going to lie. I think I am batting above my average here.
Basically Im lost. I do the transfers. What command do I use to query the list of balances per account to see what money is sitting there?
Bc I dont see how I can use the cmd above if I dont know anything about the payout yet. I still have to query the balance.
Theres nothing in the SDK that with a few calls I can retrieve it?
I think Im better just using the webhook
Do the transfer --> if successful, register as payout pending creation.
Then just let the webhooks do the rest. That to me seems the most straightforward.
And least amount of code needed to do checks.
But I wonder if its out of the question, to then do the transfer, and once the funds are available, manually commence the payout so I can store that payout ID starting with "po_"
The account balances API will do that for you, but its totals only at that point, no separation by your transfers
You can look at balance transactions before the payout creation too, but its getting really nitty gritty at that point
I wonder if I can put some metadata into the transfer object to give it a trace-ability with the payouts and do the same with the payouts.
Like a personalized ID or hash in metadata
None of that will propagate to the received payments/balance/payouts on the connected account
After you do the backtracing, you could add metadata to the transfers to mark the payout they landed in
So what do you recommend as the path with least friction? Bc I want to do avoid a cron job if the webhook puts the burden on Stripe to just notify my server when a change has happened.
What i described above: listen for payout creation events, then use the method of balance transactions + expansion to reconcile with your transfers
Reconcile with your transfers just means itll show which transfer ID the money came from?
after you create transfers and before you find it associated with the payout its some waiting state like "waiting for next automatic payout" etc
Multiple transfer potentially, but yes. Are you trying to do something else?
Honestly, I think the easiest way for me to handle this is to do the transfer, put a lock on the account id that way no more transfers can happen until I initiate the payout. Once the payout has been initiated, then I lift the lock.
Because I assume available balances are just money that is sitting there and havent been subjected to a payout yet.
Lmk if this approach makes sense. Its quick and brute in nature but it lets me initiate the payout so I can get the payout id that I then can save to my DB, and then let the webhook monitor for changes when they do come.
The only fallacy is assuming the time for the transfer to settle and the time for the payout to start are not nearly immediate causing the lock to hang for longer than usual
You can do that if that's your preferred approach and work for your business model, sure
But then you can only have one transfer/payout in flight at a time, be aware
Right but the "flight time" would only be the duration of time for the transfer to be successful and for the payout to be initiated which I assume is seconds.
That's not necessarily correct, though if you're using manual payouts i suppose it could be true
Automatic payouts can involve waiting until that happens some time later in the day (or whatever your schedule is)
Not automatic.
My understanding is thats daily or it depends on nationality of connect account.
But for manual payouts.
I would do the transfer asynchronously, and once its successful, do the manual payout.
But question. Since transfer is synchronous, once it returns successful, then that means the funds are in the connect account
Sure, that's fine then
Yes, if you're creating a transfer using available platform funds, the account receiving the transfer would have funds available immediately
Awesome. Then I am going to do that approach. My final question is that the po_ id given when I manually start a payout, will be the same for when the webhook catches it on paid, fail, updated etc.
yep!
Nice thanks for helping me brainstorm. My team tech team is still pretty nascent and isnt as advanced as a stripe engineer so a more dumbed down solution was what would work for us. Thanks bud.
NP happy to help
Darn, available on a balance means money not subject to payout right?
Just so we know how much to payout
With manual payouts, yes that should be the case
with automatic payouts its a bit more complicated, because "available" funds get earmarked for future payouts
So I should disable automatic payouts on my dashboard so no earmarking happens.
then I can query the funds available on the connect account and thats how I know how much to payout .
Are you talking about the transfers part for sending funds?
So I would transfer from the company's account to the connect account.
there would ofc be fees so the transfer amount wont be the same as the landed amount
Because your platform payout settings are separate fromthe conencted accounts. if you're going to manage manual payouts you need to set that on the connected accounts.
I cant just set a default on some settings somewhere? So everytime someone creates a connect account, I have to manually set it to manual payouts?
Like is there a way around this.
You can also set this via the API: https://docs.stripe.com/connect/manual-payouts
Including when you create the account: https://docs.stripe.com/api/accounts/create#create_account-settings-payouts-schedule-interval
So you can set that for all connected accounts when you create them
yep