#JimP

1 messages · Page 1 of 1 (latest)

tough flumeBOT
spring forge
#

if you do GET /v1/account (not /v1/accounts) with a key, it gets the details of the account owning the key

astral raft
#

Great! Sorry to be dumb: how can I do that using the PHP API? Or how do I pass the key?

#

I tried $stripe->accounts->all() but got an empty list

spring forge
#
$stripe = new \Stripe\StripeClient(
  'sk_xxx'
);
$acct = $stripe->account->retrieve([]);

it's that I think

astral raft
#

there's no function account->retrieve, just accounts->retrieve()

spring forge
#

yeah we might not expose it in the SDK since there's usually no reason to do this and it's more of a leftover API

astral raft
#

OK so what's the parameter I pass in the GET?

#

Actually I don't really want to expose a secret key in a GET request, so probably best to leave this one.

spring forge
#

hmm I mean like no, it's not exposed

#

it works like any other request, it's in the Authentication HTTP header and the request is using HTTPS in transit, there's no security risk making a GET request

#

ultimately we expect that you don't integrate this way, if you have multiple accounts that interact with each other you generally use Connect which means you only need one account's keys(the platform's) https://stripe.com/docs/connect/authentication. If you're doing something like building a plugin that uses the same code but with multiple independent accounts and just configure with their keys, that is indeed a bit of a pain unfortunately

#

what I said initially does work and in our Node library I can just do it

#

we probably just don't expose it in the PHP library because /v1/account to get your own account is kind of a crufty thing we mostly forgot exists

astral raft
#

They don't interact. It's just that I've had a case where the test key was put in earlier than the live key, and the live key was accidentally put in from another account!

spring forge
#

maybe

\Stripe\Stripe::setApiKey("sk_xxx");
$stripeAccount = \Stripe\Account::retrieve();

works

#

if not, there's probably no easy option beyond making a HTTP request directly without the library

astral raft
#

Bingo! You are a star!!! Thank you so much. 👍