What are the differences between User vs Account?

I'm integrating Better Auth into my SaaS for authentication, but these 2 terms make me confused. Is User the actual user in my system (registered via my authentication mechanism) and Account is similar to Customer in other payment platform (the link between my system and the payment platform) ?
9 Replies
Ping
Ping5mo ago
User is often more public facing info, account would contain additional and more private information about a user, such as their password, what provider they used to sign in with oauth, and other details
h8h
h8hOP5mo ago
So they are 1:1 in relation, right?
Ping
Ping5mo ago
Yes kind of, a user can also have multiple accounts. One could be for credentials so passwords, and the other could be social sign on account, but both linked to the same user Every account has a field called userId that links to a user.
h8h
h8hOP5mo ago
so now if I need to integrate my system with a payment processing service (like Polar for example), should I link the Polar's customer with User or Account?
Ping
Ping5mo ago
You can do something like this. You add the customer id on user:
No description
Ping
Ping5mo ago
And then a subscription table if you need to track:
No description
Ping
Ping5mo ago
This is from our Stripe plugin. By the way, not sure if you're aware, but there is a Polar plugin.
h8h
h8hOP5mo ago
yeah I know about the better-auth polar plugin, I also check the code here https://github.com/polarsource/polar-adapters/tree/main/packages/polar-betterauth but I can't see anything related to the database design for the customerId field, so I need to ask to be sure
GitHub
polar-adapters/packages/polar-betterauth at main · polarsource/pol...
Dead simple Checkout and Payment Integrations. Contribute to polarsource/polar-adapters development by creating an account on GitHub.
Ping
Ping5mo ago
Yeah it doesn't look like the Polar plugin extends your DB

Did you find this page helpful?