#julien_api

1 messages · Page 1 of 1 (latest)

pastel templeBOT
#

👋 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/1313911389521318021

📝 Have more to share? Add more details, code, screenshots, videos, etc. below.

half finch
#

Hello! Can you share the code that's causing that error?

austere ledge
#

Of course!

In this code, the account and onboarding methods work as expected, but the account_session method returns the error

    def account
      if resource.stripe_account_id.present?
        Stripe::Account.retrieve(resource.stripe_account_id)
      else
        object = Stripe::Account.create(default_data(:create))
        resource.update(stripe_account_id: object['id'])
        Stripe::Account.retrieve(resource.stripe_account_id)
      end
    end

    def onboarding
      Stripe::AccountLink.create({
        account: account.id,
        refresh_url: "http#{'s' unless Rails.env.development?}://#{resource.host_with_port}",
        return_url: "http#{'s' unless Rails.env.development?}://#{resource.host_with_port}",
        type: 'account_onboarding',
      })
    end

    def session
      Stripe::AccountSession.create({
        account: account.id,
        components: {
          account_onboarding: {enabled: true},
          payments: {enabled: true},
          payouts: {enabled: true},
          balances: {enabled: true},
        },
      })
    end
half finch
#

That's strange. Stripe::AccountSession.create was added in 9.1.0 and should certainly work there. How did you install the Stripe Ruby library?

austere ledge
#

this code was copied from the documentation, and I only changed the value in the "account" key

#

gem 'stripe' in my Gemfile

In Gemfile.lock, I have
stripe (7.1.0)

half finch
#

Oh, that's a much older version. You said earlier you were using 13.2.0.

#

7.1.0 doesn't have AccountSession, so what you're seeing is expected.

austere ledge
#

Indeed! Since my Rails version is 7.1.0, it was misleading 😅

half finch
austere ledge
#

Ok, I get the object now! Thanks for your help!
I will have a look at the changelog

#

Thanks for your help!

half finch
#

No problem!

zenith charm
#

Bonjour j’ai un problème je n’arrive pas à me connecter à mon compte