#arat-patel_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always 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/1372457230330232883
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
Hello
Hi there, so you want to check your platform's balance before creating a transfer?
Yes
https://docs.stripe.com/api/balance/balance_retrieve here's the API
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Yes i'm already using this but i'm explain what is my issue after using this api.
Before initiating the transfer, I call Stripe's Balance API :- stripe.balance.retrieve() to get the available and pending balances. Then, I calculate totalBalance = availableBalance + pendingBalance to check if there are sufficient funds to make the transfer.
This approach usually works, but sometimes I'm seeing cases where:
pending balance is negative, or
available balance is negative.
In such cases, the sum of available + pending still shows as positive, so the system proceeds with the transfer — but in reality, the account is in negative balance, and the transfer shouldn't happen.
I want to make sure the transfer only proceeds if there are truly sufficient funds, and that the flow fails safely when there’s not enough balance. Can you suggest the right way to handle this, so that my transfer logic works correctly every time?
You should only use the available balance for transfer
But sometimes, when I use only the available balance for instant payouts, I get an error saying that there is not enough available balance to make the transfer, possibly due to pending amounts or incoming amount.
So, do you suggest that I should just use the available balance? Will that be reliable?
Can you share with me the ID of a request?
https://dashboard.stripe.com/test/logs/req_IZuXxYQU6ZAoCx so this is the get balances API you made right before the creating the transfer. Its response indicates that available balance is negative, and therefore you got the insufficient balance error
Okay let us check again with only available balance