While working on an app that connects with Stripe Accounts, I ran into an issue. If an account already exists for a given email, I can't create a new one. Stripe throws an error.
But how do I connect to that existing account? I can't find anything anywhere to do so.
For clarity, the failing code is:
Stripe::Acount.create(managed: false, email: '[email protected]')
I'm creating a Stripe::Account
object, not a Stripe::Customer
object. The above code throws an exception if the email already exists on Stripe's API, but does not provide me with any information to connect with it.
My concern is if a user who already has a Stripe account attempts to join the site, how do I link them up.
Since you're using standalone accounts, you will not be able to create the account if the user already has a Stripe account with that email address.
In that case, you must use the OAuth flow to connect the existing account to your platform.
Note that you can use the OAuth flow to handle both cases. If the user already has a Stripe account, they can log into their existing account to connect it, and if they don't, they will be able to create a new account and connect it at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With