#dorian_organization-apikeys

1 messages ยท Page 1 of 1 (latest)

weary notchBOT
#

๐Ÿ‘‹ 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/1495840427721494651

๐Ÿ“ Have more to share? Add more details, code, screenshots, videos, etc. below.

short herald
#

dorian_organization-apikeys

spice cargo
#

howdy!

short herald
spice cargo
#

Thanks! I tried something very very similar, I'm not trying the following and still having it complain about context header:

Stripe::Event.list(opts: {stripe_context: 'acct_1TKB7IQekASihiFj'})
#

failed with the example as well

short herald
#

try this:

Stripe::Event.list({},{stripe_context: 'acct_1TKB7IQekASihiFj'})

spice cargo
#

THAT WORKED!, so I need to provide an empty hash to start?

short herald
#

yeah

#

Basically:

  • first hash: parameters to the API like limit or type for that API
  • second hash: options for that API Request like the API key or API version but also the Stripe-Account or Stripe-Context header
spice cargo
#

cool! Now for the organization level webhook, is there a way to see what account_id the event is for?

#

I've also noticed I can't use the console for some reason when I'm playing around with the organization webhook, but I can when I go into a sub-account (realty). Is this intentional?

short herald
#

I don't really grasp the second part of your question

spice cargo
#

So here I am in the organization, I've set up a webhook on the organization level for all sub accounts:

#

I don't have a way to replay events or experiment with stripe console

#

however if I go into the realty account

#

Now I can execute shell commands and thus replay events

short herald
#

Organizations API keys/Events are quite new so I assume we just haven't built this yet

spice cargo
#

gotcha, that makes sense. hm this is tricky.

#

I can probably just set it up from the realty account for now and deal with the consequences of my actions down the line

short herald
#

Up to you I would say, it all works, just the Dashboard doesn't show all features yet

spice cargo
#

and just confirming this method:

Stripe::Webhook.construct_event

the "secret" param is the webhook secret, not the api key correct?

#

I guess the reason I wanted to do it on an org level is I didn't want to juggle multiple webhook secrets and API keys, instead just have a logical switch based on the account the webhook is for

short herald
#

correct

#

and for the second part that's fair/reasonable, really depends how separate all those accounts in your Org are

spice cargo
#

So instead of using API keys, I can pass the webhook context through to the api call? I don't even need to pull the API key of the sub account

#

That seems cleanest

#

1 webhook secret, 1 api key, conditional logic based on the context

short herald
#

yes that's the goal of Organization API keys!

spice cargo
#

you guys think of everything. thank you very much. I should be able to figure it out. I do wish you guys have the stripe console setup for org level stuff / dashboard since I feel slightly crippled without it but this is nitpicky

short herald
spice cargo
#

actually, last question

#

I think the way it makes sense to do this is to have a StripeClient for each account. Is it possible to just initialize a stripeclient with the context such that I don't have to set it each time?

#

oh yes lol

#

literally there

short herald
spice cargo
#

how would I go about replaying an org level webhook event?

short herald
#

I don't think we support this yet sorry. At least I see nothing on our Stripe CLI about --stripe-context so I think it's coming in the future

spice cargo
#

is there a way to send a test event from the org webhook?

short herald
#

I don't know ๐Ÿ˜“
Sorry I wish I had a better answer but this is all super new and I almost never use the Dashboard

#

Really don't focus too much on the UI per se. Create a Customer on one of your account and see the customer.created be sent

spice cargo
#

that's actually very valid, I will try and just trigger events via misc actions