#_desa

1 messages · Page 1 of 1 (latest)

hushed heathBOT
wintry jewel
#

I asked a similar question yesterday, but am just now getting around to solving it, synthwave was who i was talking ot

cold needle
#

Hello, I think this usually happens if you specify capabilities when creating the account

#

If you create the account without requesting capabilities and then create the account links, does that work?

wintry jewel
#
    admin_user = current_admin_user

    if admin_user.stripe_account_id.nil?
      account = Stripe::Account.create(
        type: 'custom',
        email: admin_user.authentication.email,
        requested_capabilities: ['card_payments', 'transfers']
      )
      Rails.logger.info("Created stripe account: #{account}")
      admin_user.update(stripe_account_id: account.id)
    else
      account = Stripe::Account.retrieve(admin_user.stripe_account_id)
    end

    account_link = Stripe::AccountLink.create(
      account: account.id,
      refresh_url: "#{ENV.fetch('ADMIN_HOST_DOMAIN')}/account/edit",
      return_url: "#{ENV.fetch('ADMIN_HOST_DOMAIN')}/account/edit",
      type: 'account_onboarding'
    )

    render json: account_link, status: :ok
  end```
#

is my current code - let me check by removing requested_capabilities

#
You must request one or more of the following capabilities: transfers. Please visit https://stripe.com/docs/connect/account-capabilities to learn more.```
cold needle
#

Apologies that I was mistaken. Looking in to that error and double checking what I said about the country being locked in when you specify capabilities

wintry jewel
#

making it only transfers seems to no longer have it ask for address or ssn.. which is interesting, idk if there is a difference between my test env and prod, because it seems like if they get sent right to adding a bank that'll work, but in the dashboard they do still have the US flag

#

req_LOB6CSjliXnJIV if this is helpful is the original account link request

cold needle
#

Thank you, was just about to ask for that ID

#

Can you send the ID for the time you got the error about needing to request transfers

wintry jewel
#

i don't think it made it past the ruby gem

#

nvm - it did sec

#

req_fozp9PCAYTuLkw

cold needle
#

Ah, so my advice applied to Express accounts. For Connect accounts you need to specify the capabilities and country upfront. So it would be best to collect the user's country code before creating their account

wintry jewel
#

hmmmmmm

#

what countries are supported

#

i'll just make dropdown on the front end that passes it to the endpoint which is fine, i also just need the country codes/abbreviations

#

if there is a handy dandy doc for that somewhere

cold needle
#

Looking for the doc on that and will get back to you

wintry jewel
#

ty

#

here's what i'm about to test - let me know if this seems like we're on the same page:

    admin_user = current_admin_user

    if admin_user.stripe_account_id.nil?
      account = Stripe::Account.create(
        type: 'custom',
        country: params[:country],
        email: admin_user.authentication.email,
        requested_capabilities: ['card_payments', 'transfers']
      )
      Rails.logger.info("Created stripe account: #{account}")
      admin_user.update(stripe_account_id: account.id)
    else
      account = Stripe::Account.retrieve(admin_user.stripe_account_id)
    end

    account_link = Stripe::AccountLink.create(
      account: account.id,
      refresh_url: "#{ENV.fetch('ADMIN_HOST_DOMAIN')}/account/edit",
      return_url: "#{ENV.fetch('ADMIN_HOST_DOMAIN')}/account/edit",
      type: 'account_onboarding'
    )

    render json: account_link, status: :ok
  end```
cold needle
wintry jewel
#

do you have the abbreviations for the countries anywhere?

#

ie - united states = US
philippines = ?

cold needle
#

Stripe doesn't list them but we do use ISO standard ones https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2

ISO 3166-1 alpha-2 codes are two-letter country codes defined in ISO 3166-1, part of the ISO 3166 standard published by the International Organization for Standardization (ISO), to represent countries, dependent territories, and special areas of geographical interest. They are the most widely used of the country codes published by ISO (the other...

wintry jewel
#

oh sweet, that's exactly what i was hoping for

#

did you take a sec to read the code i sent over to see if we're on the same page there? i'd just pass in the country code as a param on the front end

cold needle
#

Apologies, misread that message. Yep that code looks like what I was saying, if you test with that it should work as long as a proper country code is passed to your backend