#brotzka-de-en_api

1 messages ¡ Page 1 of 1 (latest)

visual warrenBOT
#

👋 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/1263074070216310825

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

shadow harbor
#

Here is my current code:

class StripeAccounts extends StripeObject
{

    protected $client;

    public function __construct()
    {
        $this->client = new Client([
            'base_uri' => 'https://api.stripe.com/v1/',
            'headers' => [
                'Authorization' => 'Bearer ' . config('services.stripe.secret'),
                'Content-Type' => 'application/x-www-form-urlencoded'
            ]
        ]);
    }

    public function getAccountSession(string $stripeAccount, array $components = [])
    {
        try  {
            $response = $this->client->post('account_sessions', [
                'form_params' => [
                    'account' => 'acct_1Jf381GZZP7fzSzR',
                    'components' => [
                        'balances' => [
                            'enabled' => 'true'
                        ]
                    ]
                ]
            ]);
        } catch(\Exception $ex) {
            dd($ex->getMessage());
        }
        
        dd($response->getStatusCode(), json_decode($response->getBody()->getContents()));


        if ($response->getStatusCode() !== 200) {
            throw new \Exception("Could not get credentials " . $response->getReasonPhrase());
        }

        $data = json_decode($response->getBody()->getContents());
    }
}
#

I cannot use the Stripe SDK for PHP as I have to use an older version of the SDK regarding our old PHP version.

fluid schooner
#

hi! sounds like you used the wroing API key then (sk_test_xxx instead of sk_live_xxx or vice versa).

shadow harbor
#

So I was assuming that I can access it via the API in testmode

fluid schooner
#

I'm a bit confused, did you connect to that account over OAuth?

shadow harbor
#

Yes

#

I've generated a Connect-link via the api which then was used to connect to account to our platform account in test mode

fluid schooner