#d_bongz
1 messages · Page 1 of 1 (latest)
Hi there!
Hi Soma
You can list the payouts of a connected account, and check their status.
https://stripe.com/docs/api/payouts/list?lang=node
https://stripe.com/docs/api/payouts/object?lang=node#payout_object-status
Thanks, is there a way I can identify the transfer object used to initiate the payout from the payout object?
This is covered here: https://stripe.com/docs/expand/use-cases#charges-in-payout
Thanks, I am assuming this will retrieve the balance transaction of this specific payout?
Stripe\BalanceTransaction::all([ 'payout' => 'po_1Gl3ZLLHughnNhxyDrOia0vI', 'type' => 'charge', 'expand' => ['data.source'], ]);
yes
But this code is to get the balance transactions of your own Stripe account. If you want them from a connected account, you have to use the Stripe-Account header: https://stripe.com/docs/connect/authentication
Something like this?
Stripe\BalanceTransaction::all([ 'payout' => 'po_1Gl3ZLLHughnNhxyDrOia0vI', 'type' => 'charge', 'expand' => ['data.source'], ], ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}' ] );
Yes, just make sure to replace '{{CONNECTED_ACCOUNT_ID}} with an actual account ID (acct_xxx).
This will be a bit tricky to how the logic is currently working on my side.
After I have transferred the funds to the connect account I am storing these details.
PayoutTransfer::create([ 'transaction_id' => $transfer->balance_transaction, 'transfer_id' => $transfer->id, ]);
at this point the payout ID is not available so determine the connect_account_id will be a challenge.
👋 taking over for my colleague. Let me catch up.
Thanks Tarzan
I'm not sure I really follow
Ok so what I am trying to achieve is to determine the originating source (transfer object) of the payout associated to a connect account.
this is explained here https://stripe.com/docs/expand/use-cases#charges-in-payout
I get that, but as per this snippet how would one know the payout_id belongs to that specific stripe_account?
$balanceTransactions = \Stripe\BalanceTransaction::all([ 'payout' => 'po_1G7bnaD2wdkPsFGzdVOqU44u', 'type' => 'payment', 'expand' => ['data.source.source_transfer.source_transaction'], ], [ 'stripe_account' => 'acct_1G7PaoD2wdkPsFGz', ]);
where are you storing the Payout ID?
I am transferring the funds to the connect account, when the transfer is created I only get the transfer Id
$transfer = Transfer::create([ 'amount' => $this>calculateStripePayoutTotal($amount, $user_id), 'currency' => config('services.currency'), 'destination' => $desitnation, 'description' => 'Payment for project '.$description, 'source_transaction' => $source_transaction, 'transfer_group' => $transfer_group, 'metadata' => $metadata, ]);
when you retrieve the transfer you can always get the destination which is the connected account ID
Yes but the snippet below requires a payout ID not the transfer ID
\Stripe\BalanceTransaction::all([ 'payout' => 'po_1G7bnaD2wdkPsFGzdVOqU44u', 'type' => 'payment', 'expand' => ['data.source.source_transfer.source_transaction'], ], [ 'stripe_account' => 'acct_1G7PaoD2wdkPsFGz', ]);
let's forget about codes for a second
would you mind describing the steps of what you want to achieve and what information are you saving in your DB?
In the DB I am storing the user connect_id
this connect_id is used as the destination when creating a transfer.
What I am trying to achieve.
Create a transfer for a specific user to their connect_account
Obtain a commission from the amount to be transferred
Get notified when Stripe payouts the transferred amount to the user external account
Update the payout status in the DB.
Issue
I am not able to get the payout ID after the transfer is created to be associated to the user connect_account to make the neccesary DB updates
when you store the payout ID in your db, store the connected account ID in a separate column
this way you can always link the payout ID to the relevant connected ID
I hear you but when I create the transfer object I don't get the payout ID
but you're creating the payout manually right?
No, when I create the transfer does this take place immediately and if I were to create a manual payout can I use the transfer object as the source?
if you're not creating the payouts manually, how are you getting the payout IDs then?
I hear, so the transfer object won't initiate Stripe to automatically payout the funds to the external account?
How long does it take for the funds to reflect in the connect_account after the transfer? and is it possible to use the transfer id as the amount to be paid out?
the transfer will make an amount available in the Connected Account's balance
and based on the automatic payouts settings, the amount will be paid
you can use the Connect Webhooks to listen to payout.created event
to know when a payout is being created on a connected account