#Pradeep
1 messages · Page 1 of 1 (latest)
Do you have a request ID for the request that gave you that error?
Here's how you can find a request ID: 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.
wait
I do not have that req Id
actually I think it wasn't received at stripe server
That is php Error
Ahhh, okay. That makes sense. Are you able to step through the code and figure out why the error is occurring?
Actually, as per this article
https://stripe.com/docs/connect/account-balances#accounting-for-negative-balances
I am trying to get the balance before payout
but the same code is not working at my side
Can you copy/paste the full code here for me to look at?
$balance = $stripe->balance->retrieve(['stripe_account' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}']);
where I have CONNECTED_STRIPE_ACCOUNT_ID stored in my database
$stripe = new \Stripe\StripeClient(STRIPE_CLINET_KEY);
$balance = $stripe->balance->retrieve(['stripe_account' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}']);
is STRIPE_CLINET_KEY also misspelled in your code?
No, other thing is working great like stripe payout as well but when I was trying to get the balance it gives the error If i remove this code everything works great
Your code looks a little different from the code we have in our docs:
$balance = \Stripe\Balance::retrieve(
['stripe_account' => '{{CONNECTED_STRIPE_ACCOUNT_ID}}']
);
Can you try this format/syntax and see if that fixes it?
this is the same just I am using the object method not the static method
If you check the API this is the same code
https://stripe.com/docs/api/balance/balance_retrieve
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
Ah, that's fair (apologies, I'm not super familiar with PHP). Are you authenticated as the Connect account? In other words, are you making sure to use one of the method of authentication mentioned here?
yes that is the making API call through connect
cause I want to know the balance that connect account has for payout
You have to pass the account header in addition to stripe_account and you didn't post any of the code that should be doing that
As far as I can tell from the code you posted, you have not authenticated the request
The Stripe-Account header approach is implied in any API request that includes the Stripe account ID in the URL.
the same link says, it is implied in API
I have used the same code for refund and it works
give me a sec @dim prawn
I think I know what you're mistaking
you're passing the stripe_account field in the first paramter of balance.retrieve() , it needs to be the second parameter, which is known as the "options" param
but what to send first parameter
just an empty hash []