Authorizing Users and connecting to Square API Customer Object

I am creating a web app and am thinking to use Square for my coffee shop, which will allow customers to place online orders that are sent to the Square POS. I read in the documentation that orders can reference a Customer profile. During my planning, I have a question regarding the authorization and how to connect the Customer object to registered Users in my Postgres database.

I see from this post User authentication in mobile app - Questions - Square Developer Forums (squareup.com) that there is no kind of customer authentication so I will still need a backend to store registered users data.

Whenever a new user is registered and stored in my database, should I also create a new Customer object using the customers api, and then save that customer_id inside my database? What I’m thinking is once the user is logged in, I can save the customer_id in the current session when the user is logged in, and then whenever an order is placed, the Order will reference the logged in customer_id.

Let me know if this makes sense or if there is a better practice for this use case.

Thank you!

That’s exactly how we recommend connecting the customer in Square’s database with the customer in your database. :slightly_smiling_face:

1 Like

Thanks, Bryan! I appreciate it. Looking forward to exploring the Square API some more & joining the forum community - seems like there’s tons of great features for my use case. :smile: