#d_bongz

1 messages · Page 1 of 1 (latest)

dapper inletBOT
wild coral
#

Hi there!

molten ruin
#

Hi Soma

wild coral
molten ruin
#

Thanks, is there a way I can identify the transfer object used to initiate the payout from the payout object?

wild coral
molten ruin
#

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'], ]);

wild coral
#

yes

molten ruin
#

Something like this?

Stripe\BalanceTransaction::all([ 'payout' => 'po_1Gl3ZLLHughnNhxyDrOia0vI', 'type' => 'charge', 'expand' => ['data.source'], ], ['stripe_account' => '{{CONNECTED_ACCOUNT_ID}}' ] );

wild coral
#

Yes, just make sure to replace '{{CONNECTED_ACCOUNT_ID}} with an actual account ID (acct_xxx).

molten ruin
#

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.

dapper inletBOT
austere grail
#

👋 taking over for my colleague. Let me catch up.

molten ruin
#

Thanks Tarzan

austere grail
molten ruin
#

Ok so what I am trying to achieve is to determine the originating source (transfer object) of the payout associated to a connect account.

austere grail
molten ruin
#

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', ]);

austere grail
#

where are you storing the Payout ID?

molten ruin
#

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, ]);

austere grail
#

when you retrieve the transfer you can always get the destination which is the connected account ID

molten ruin
#

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', ]);

austere grail
#

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?

molten ruin
#

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

austere grail
#

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

molten ruin
#

I hear you but when I create the transfer object I don't get the payout ID

austere grail
#

but you're creating the payout manually right?

molten ruin
#

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?

austere grail
#

if you're not creating the payouts manually, how are you getting the payout IDs then?

molten ruin
#

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?

austere grail
#

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