#nickdnk - tr_ objects
1 messages · Page 1 of 1 (latest)
It comes from listing all payouts
So it's not me putting it in there
If I click that I just get "not found"
So it kind of exists but not really
I think I'l have to filter out objects that don't start with po_ just to be sure I don't get something unexpected in there
Had to bounce around other threads a bit and am looking now
(thanks for the assist on the iOS question by the way)
Out of curiosity, have you tried retrieving it as a Payout or Transfer via the API?
Oh right listing it would show the same data
I would assume yes
So the reason these have tr_ IDs is that before API Version 2017-04-06, the Transfer resource described both transferring funds to connect accounts and transferring money to external accounts. Now those are Transfers and Payouts respectively https://stripe.com/docs/upgrades#2017-04-06
And this looks to be a dashboard bug where it assumes the wrong object type based on its ID. You should be able to see this if you go to https://dashboard.stripe.com/payouts/tr_19XnyTBx7bWdyGx7q4HKM0if
Ahem, sorry, clicked the wrong copy button
Aye aye
I have not seen that movie, took me a second
It's Captain Phillips
Tom Hanks
pretty good
But thanks, I'll just ignore these objects then and only store po_
You're welcome
I'm having another weird problem
I'm getting duplicate objects when paginating lists and I can't find out why
I'm looping all my connected accounts and fetching their payouts, but for some reason I end up with 58 duplicates out of 1600-ish payouts
Is this list not expected to return consistent data when paginating?
$payoutsToInsert = [];
foreach ($venues as $venue) {
$payouts = Payout::all(['expand' => ['data.destination']], ['stripe_account' => $venue['stripe_account']]);
$payoutFlattened = $payouts->data;
echo "Building payout list..." . PHP_EOL;
while ($payouts->has_more) {
/** @var Account $last */
$last = $payouts->data[count($payouts->data) - 1];
echo "Paginating " . $last->id . '...' . PHP_EOL;
$payouts = Payout::all(
['starting_after' => $last->id, 'expand' => ['data.destination']],
['stripe_account' => $venue['stripe_account']]
);
foreach ($payouts->data as $a) {
$payoutFlattened[] = $a;
}
}
echo "Fetched " . count($payoutFlattened) . ' Payouts for ' . $venue['stripe_account'] . PHP_EOL;
foreach ($payoutFlattened as $fp) {
$payoutsToInsert[] = [
'venue' => $venue['venue'],
'payout' => $fp
];
}
}
quick and dirty script looks like this. Anything that catches your eye that could cause duplicates in the flattened array?
I'm mapping it like this because I need to sort all of the payouts by timestamp once I've completed the list
but at this stage there are already duplicates
I'm going to try the auto-paginator from the Stripe library instead
That is interesting. Nothing immediately jumping out at me.
Was about to ask about the auto-paginator, let me know if there are duplicates there. It should be running pretty similar code
Yes hold on I'll try
yes still duplicates
exactly the same result
58 duplicates, 1585 unique, so 1643 objects fetched
I feel like I'm missing something totally obvious here but I just don't see what's wrong
just to show what I'm doing now
Sorry, i copy pasted wrong
$payoutsToInsert = [];
foreach ($venues as $venue) {
$payouts = Payout::all(['expand' => ['data.destination']], ['stripe_account' => $venue['stripe_account']]);
echo "Building payout list..." . PHP_EOL;
foreach ($payouts->autoPagingIterator() as $payout) {
$payoutsToInsert[] = [
'venue' => $venue['venue'],
'payout' => $payout
];
}
}
there
and the duplicates seem to be randomly distributed in the whole list
it's not like a big chunk
Thank you. That is interesting, doesn't look like it is on every page because the default page size is 10 so there would be more. Trying to think of how to look in to this
I can try increasing the page size of course
hold on
let me run it with 100
no change
58 dupes
but it ran faster 😄
I have a duplicate account in my list... somehow. That might explain it
Yeah that's why
a Stripe account has been connected to two different venues (same physical venue, two accounts in our system)
It also matches with the venue having 58 payouts
So I'm not crazy
Oh gotcha. Very good catch.
Of course, happy to help!
@lusty turret just confirming I can archive this thread?