#karam_api
1 messages ¡ Page 1 of 1 (latest)
đ Welcome to your new thread!
â˛ď¸ We'll be here soon! We typically respond in a few minutes, but in some cases we might need a bit more time (e.g., server's busy, you've got a complex question, etc.).
âąď¸ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can 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/1260498309311889449
đ Have more to share? Add details, code, screenshots, videos, etc. below.
You can pass the Stripe Account header to each of the Conneted Account on the samve /v1/balance API to see each account's balance
You can then loop over all your Connected Account and do the same thing
That's what I have done for now :
$stripeClient = app(StripeClient::class);
$connectedAccountBalance = [];
// Get all connected Accounts
$connectedAccount = $stripeClient->accounts->all();
while ($connectedAccount->has_more) {
$connectedAccount = $stripeClient->accounts->all([
'starting_after' => $connectedAccount->data[count($connectedAccount->data) - 1]->id,
]);
// For each connected account, get the balance
foreach ($connectedAccount->data as $account) {
$balance = $stripeClient->balance->retrieve(
[], // <-- i would like to pass a datetime here to get the balance at a specific date
['stripe_account' => $account->id]
);
$connectedAccountBalance[] = [
'id' => $account->id,
'name' => $account->business_profile->name,
'balance' => $balance->available[0]->amount / 100,
];
}
}
return response()->json($connectedAccountBalance);
But this gives to current balance
what I want, is having the balance at a specific date
Isn't there another way to calculate it ?
ie: get all cash IN and OUT transactions for a specific connected account ?
so i can calculate the balance myself ?
It could be complicated because many thing hits the balance. I think the closest reliable way is to list all the Balance Transactions and reverse-calculate until the date
using this endpoint "/v1/balance_transactions" ?
Yes