Ask A Question


You’re not receiving notifications from this thread.

Stripe connect managed accounts

josh edgar asked in Rails

I'm trying to add webhooks to stripe using stripe connect and managed accounts

I'm using the stripe_events plugin and have followed your stripe webhooks video. I nearly have it working but I have to add an "account" attribute somewhere?!?! I've been looking at the screen to long. Can you please help!


Stripe.api_key = Rails.configuration.stripe[:secret_key]

class RecordAccount
    def call(event)
        event =
        account = event.account

        #Look up StripeAccount in our database
        stripe_account = StripeAccount.where(stripe_id: account).last

        #Record Verification details, status in StripeAccount
        u = stripe_account.update_attributes(verification_status: event.legal_entity.verification.status, verification_details: event.legal_entity.verification.details)


StripeEvent.configure do |events|
  events.subscribe 'account.updated',

Ended up removing the stripe_event gem and set up webhooks manually. Was very easy...

created a webhooks_controller.rb and new post route

            payload = JSON.parse(
            # Verify the event by fetching it from Stripe
            if payload['account'].present?

              # This is for connected accounts
              event = Stripe::Event.retrieve(payload['id'], stripe_account: payload['account'])
              @stripe_object =
              @stripe_account_update = StripeAccount.where(stripe_id: payload['account']).first!

                    # update verification status etc in db
              u = @stripe_account_update.update_attributes(
                    verification_status: @stripe_object.legal_entity.verification.status, 
                    verification_details: @stripe_object.verification.fields_needed

              # Normal events not using stripe_event

            rescue Stripe::StripeError => e
            # Handle this however you prefer

Only thing I need to figure out is how to read the event type "account_created", "account_updated" etc. Haven't looked into it yet. But I'm sure there's nothing to it.

Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 82,160+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more.

    © 2024 GoRails, LLC. All rights reserved.