Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when trying to create standard connect account with business type #852

Closed
oladejihenry opened this issue Oct 6, 2023 · 3 comments
Closed

Comments

@oladejihenry
Copy link
Contributor

oladejihenry commented Oct 6, 2023

i tried doing this in my controller

account = @user.merchant_processor.create_account( type: 'standard', email: current_user.email, business_type: 'individual', business_profile: { url: 'http://lvh.me' } )

but when i try running the code i get this error

You cannot create Standard connected accounts with capabilities via API.

but when i remove the business_type and business_profile i was able to create the standard account for some weird reason. when i checked the log i see this
{ "type": "standard", "email": "sample@gmail.com", "business_type": "individual", "business_profile": "http://lvh.me", "capabilities": { "card_payments": { "requested": "true" }, "transfers": { "requested": "true" } } }

as seen above it keeps adding capabilities for some weird reason.

@oladejihenry
Copy link
Contributor Author

oladejihenry commented Oct 7, 2023

Also is it possible that this @user.set_payment_processor :stripe, stripe_account: "acct_1234" can be added to the README for connected account/marketplace because i spent almost all day trying to troubleshoot it. but #565 helped

I am new to rails so at first i did not know you can pass the stripe_account as seen above what i did previously was this

def show

        checkout_session = Stripe::Checkout::Session.create({
            mode: 'subscription',
            locale: I18n.locale,
            line_items: [{
                price: plan.stripe_price_id,
                quantity: 1
            }],
            subscription_data: {
                'application_fee_percent' => 10,
                metadata: {
                pay_name: plan.stripe_name # Optional. Overrides the Pay::Subscription name attribute
                },
            },
            success_url: post_show_url(subdomain: blog.name, id: latest_post.id),
            cancel_url: post_show_url(subdomain: blog.name, id: latest_post.id),

       },
      stripe_account: "acct_1234""
 )
        redirect_to checkout_session.url,  allow_other_host: true, status: :see_other
    end

that did not create the customer or add the subscription to pay_subscription table. So in the process of making research i saw this #565 but i have made a PR #853 for beginners like me.

@oladejihenry
Copy link
Contributor Author

oladejihenry commented Oct 15, 2023

I was able to solve the first problem by doing this

account = Stripe::Account.create({
            type: 'standard',
            email: current_user.email,
            business_type: 'individual'
        })

        @user.pay_merchants.find_or_create_by(
            processor_id: account.id,
            processor: :stripe 
        )

i tried doing this in my controller

account = @user.merchant_processor.create_account( type: 'standard', email: current_user.email, business_type: 'individual', business_profile: { url: 'http://lvh.me' } )

but when i try running the code i get this error

You cannot create Standard connected accounts with capabilities via API.

but when i remove the business_type and business_profile i was able to create the standard account for some weird reason. when i checked the log i see this { "type": "standard", "email": "sample@gmail.com", "business_type": "individual", "business_profile": "http://lvh.me", "capabilities": { "card_payments": { "requested": "true" }, "transfers": { "requested": "true" } } }

as seen above it keeps adding capabilities for some weird reason.

@excid3
Copy link
Collaborator

excid3 commented Oct 17, 2023

Since Stripe doesn't allow that, you'll want to include capabilities: nil so that our default values don't get included in the request.

@excid3 excid3 closed this as completed Oct 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants