Closed patrickslin closed 8 years ago
I found that this is due to stripe_event not supporting managed accounts. To retrieve the event for those accounts, the "stripe_account" needs to be specified.
event = Stripe::Event.retrieve({params[:id]},{:stripe_account => "acct_xxxx"})
Any plans on supporting this? Thanks.
In practice, it seems like it's sufficient to conditionally pass params[:user_id]
through as a :stripe_account
argument when present:
StripeEvent.event_retriever = lambda do |params|
api_key = # whatever's needed to lookup api key for top level account
stripe_opts = {api_key: api_key}
stripe_opts.merge! stripe_account: params[:user_id] if params[:user_id]
Stripe::Event.retrieve({id: params[:id]}, stripe_opts)
end
If your webhook receives events for "connected" accounts, a :user_id
param will be present.
Instead if your webhook receives events for the top-level (standalone) account, the :user_id
param will not be present.
Yes. Thanks. This is just what I have done. It's working now.
Hi,
I'm trying to test the account.updated webhook, but my subscriber objects are not called and the status is 401.
But, other events, such as charge.succeeded work with no problem.
I am using ngrok to expose my local server to Stripe for the webhook endpoints. But, I don't believe that this is causing any issue. Could it be due to this being a "managed account"? Does that matter?
Thanks, Patrick