#dorian_organization-apikeys
1 messages ยท Page 1 of 1 (latest)
๐ 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.
dorian_organization-apikeys
howdy!
๐ did you see https://docs.stripe.com/keys?lang=ruby#organization-api-keys these docs show code examples in all languages
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
try this:
Stripe::Event.list({},{stripe_context: 'acct_1TKB7IQekASihiFj'})
it's basically the same as the Stripe-Account header https://stripe.com/docs/connect/authentication#stripe-account-header
THAT WORKED!, so I need to provide an empty hash to start?
yeah
Basically:
- first hash: parameters to the API like
limitortypefor that API - second hash: options for that API Request like the API key or API version but also the
Stripe-AccountorStripe-Contextheader
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?
yeah see https://docs.stripe.com/webhooks#webhook-endpoint-def which says there's context that tells you what account this is coming from
I don't really grasp the second part of your question
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
Organizations API keys/Events are quite new so I assume we just haven't built this yet
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
Up to you I would say, it all works, just the Dashboard doesn't show all features yet
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
correct
and for the second part that's fair/reasonable, really depends how separate all those accounts in your Org are
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
yes that's the goal of Organization API keys!
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
Make sure to flag it to our support team who track those kind of requests: https://support.stripe.com/contact
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
https://github.com/stripe/stripe-ruby/blob/master/lib/stripe/stripe_client.rb#L21 yeah the code supports it
how would I go about replaying an org level webhook event?
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
is there a way to send a test event from the org webhook?
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
that's actually very valid, I will try and just trigger events via misc actions