#Pradeep

1 messages · Page 1 of 1 (latest)

tired gladeBOT
distant star
#

Do you have a request ID for the request that gave you that error?

dim prawn
#

wait

#

I do not have that req Id

#

actually I think it wasn't received at stripe server

#

That is php Error

distant star
#

Ahhh, okay. That makes sense. Are you able to step through the code and figure out why the error is occurring?

dim prawn
#

but the same code is not working at my side

distant star
#

Can you copy/paste the full code here for me to look at?

dim prawn
#

$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}}']);

distant star
#

is STRIPE_CLINET_KEY also misspelled in your code?

dim prawn
#

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

distant star
#

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?

dim prawn
#

this is the same just I am using the object method not the static method

distant star
dim prawn
#

yes that is the making API call through connect

#

cause I want to know the balance that connect account has for payout

distant star
#

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

dim prawn
#

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

mint compass
#

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

dim prawn
#

but what to send first parameter

mint compass
#

just an empty hash []

dim prawn
#

ok

#

this worked bro, thanks a lot