Currently all interactions when using the better-auth plugin are done via the user.id which references the customer.externalId in Polar. Better-auth allows the concept of organisations through the organisation plugin. It would be good to allow the polar plugin to decide what will be used as the referencing id.
A possible solution could be to give a callback function in the configuration of the plugin that allows the user to decide how we deconstruct the session to get the ID.
something like:
export const auth = betterAuth({
plugins: [
polar({
getExternalId(session) {
return session.session.activeOrganizationId;
}
})
]
});
if this is not possible are there other ways this could be achieved currently?