Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
353 stars 102 forks source link

Duplicate entry 'shop@xxx.myshopify.com' for key 'users_email_unique' #143

Closed alexiovay closed 1 year ago

alexiovay commented 1 year ago

Hello,

I want to create a new Shopify merchant app. After testing to create my first subscription I get this error message:

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'shop@xxx.myshopify.com' for key 'users_email_unique'

I'm not quite aware about the whole flow of laravel-shopify but it seems InstallShop.php tries to create a new user and therefor this error occurs.

It is normal that a new user gets created on the first visit, I assume? I followed the installation wiki and trying to implement Stripe to get payments of merchants for this app.

Kyon147 commented 1 year ago

@xeisu it sounds like you are trying to create your own billing using Stripe, rather than Shopify's built-in billing.

It's not something the package is set up to do, but there can only be one shop record in the users table, you are trying to create another one from the looks of it. So you need to change your logic, so that you are not trying to create a shop that already exists.

alexiovay commented 1 year ago

Thank you for your fast reply!

I think my issue was that I was installing the old files by the previous author of this package and didn't had these migration files for my database yet (like "plan", "charges"). I just realized that this provides a billing service out of the box it seems?

I found it hard to research about the built-in billing since the search results mostly showed up a subscription model for products.

So I guess the best way for me would be to start fresh and install this package here. Thank you.