#Edem-payouts
1 messages · Page 1 of 1 (latest)
Hi there!
I believe that's only possible for automatic payouts https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-payout
A manual payout allows you to send an arbitrary amount of your current balance to your bank, so this amount isn’t tied to the specific charges included in that payout.
thank you for your reply
From docs:
List all balance transactions
Returns a list of transactions that have contributed to the Stripe account balance (e.g., charges, transfers, and so forth). The transactions are returned in sorted order, with the most recent transactions appearing first
Appearing first means "created" field, so... transactions sorted by created time in UTC?
Yes, the latest balance transaction will appear at the top.
Can I say that when I go through the balance transactions in reverse order, if I find a payout, then the previous transactions before this payout relate to this payout?
I don't think so. Like if you have 10 balance transactions of $1 each, and then do a manual payout for $5, then not all balance transactions belong to that payout.
if we are aware that there is no manual payout?
If there are no manual payouts, then I recommend using https://stripe.com/docs/api/balance_transactions/list to get all balance transaction for a given payout.
You're right. Anyway, I'm sorry...Let me explain. We don't know anything about payouts (we only know that they are automatic), and we have time constraints on code execution, so we want to iterate through the list of balance transactions (using the range date and reverse sorting) and group these transactions by payout when we receive it at a certain iteration step, knowing that the previous transactions relate to this payout
What do you mean by "we have time constraints on code execution"? Using https://stripe.com/docs/api/balance_transactions/list is too slow?
we have to make a lot of requests for different stripe accounts, as a minimum
it will be good for us if we can iterate through the list of balance transactions using only range date
Can you not achieve that with the created parameter? https://stripe.com/docs/api/balance_transactions/list#balance_transaction_list-created
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
i.e. pass created.gte & created.lte to create your date range
Yes, I meant it when said "date range"
Does that help?
I am trying to use the above algorithm: get the balance of transactions sorted by create date in a certain date range, then iterate over them and check if the transaction is a payment, then I get previous transactions created before this one that are not a payment, thus grouping them by payments
But it is no correct, if I use https://stripe.com/docs/api/balance_transactions/list to get all balance transaction for a given payout. 😦
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
What is not correct?
Is the request failing? The data not what you're expecting?
Can you share the req_xxx ID?
What is it that you're actually trying to do?
I get unexptected data
Sorry, I have no req_xxx Id
You can find it on your Dashboard: https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Or can you share the code you're using
I will share the code)
var balanceTransactionListOptions = new BalanceTransactionListOptions()
{
Created = new DateRangeOptions { GreaterThanOrEqual = from, LessThanOrEqual = to },
Expand = new List<string>
{
"data.source.source_transfer",
"data.source.transfer_reversal.transfer",
"data.source.source_transfer_reversal.transfer",
"data.source.metadata"
},
};
var requestOptions = CreateRequestOptions(stripeData);
var balanceTransactionsEnum = _stripeBalanceTransactionService
.ListAutoPagingAsync(balanceTransactionListOptions, requestOptions, cancellationToken)
.GetAsyncEnumerator(cancellationToken);
var balanceTransactions = new List<BalanceTransaction>();
// iterate through all balance transactions
while (await balanceTransactionsEnum.MoveNextAsync().ConfigureAwait(false))
{
balanceTransactions.Add(balanceTransactionsEnum.Current);
}
var payoutTransactions = new Dictionary<Payout, List<BalanceTransaction>>();
balanceTransactions = balanceTransactions
.OrderBy(x => x.Created)
.ToList();
var lastPos = 0;
for (int i = 0; i < balanceTransactions.Count; i++)
{
if (balanceTransactions[i].Source is Payout payout)
{
payoutTransactions.Add(payout, new List<BalanceTransaction>());
for (int j = lastPos; j < i - 1; j++)
{
payoutTransactions[payout].Add(balanceTransactions[j]);
}
lastPos = i + 1;
}
}
maybe screenshot is better
cool
so you said
I get unexptected data
what's unexpected exactly?
the code seems fine and very sensible overall but I'm not really following what you're asking, you just said "But it is no correct" and you get something unexpected so it's hard to understand.
I checked this algorithm.
Using payouts' ids and make requests to get list of balance_transactions by payout_id, saw that grouped transactions by payout (in screenshot) have the differend data
I hope I was able to convey the idea)
grouped_balance_Transactions file shows what transactions belong to payout
what_expected file is expected result, when I can check what real transactions belong to payout
sorry, this is beyond what we can help with here
I'd suggest writing to https://support.stripe.com/?contact=true with the full details
Oh,... ok! Thank you for your time!
One question
Maybe it is confident
Can you describe some steps of what how do you define which balance_transactions belong to a payout'id ?
the ones whose funds were paid out in that pay out
in our dashboard I can generate payout excel for the whole period, but how it works....