npm / @polar-sh/better-auth
@polar-sh/better-auth
What changed in @polar-sh/better-auth 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-19.
7 breaking2 new APIs and options1 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@polar-sh/better-auth 210 changes
Breaking changes 7
The peer dependency now requires Better Auth ^1.7.0.
Create the client option with createPolarCore instead of createPolar, importing it from @polar-sh/sdk/2026-10.
Existing customers without an external ID retain one-time linking, while conflicting customer identities are rejected rather than replacing an immutable external ID.
The relink path now filters to individual customers and throws CONFLICT if a team customer already holds the signup email, preventing its external_id from being overwritten.
Custom plugins passed through use now receive a PolarCore and must use standalone SDK functions with it.
For client calls to endpoints that also accept a body, pass query parameters through fetchOptions rather than as a top-level query.
Anonymous sessions are rejected before their session ID is forwarded as Polar externalCustomerId, preventing orphan meter events.
New APIs and options 2
Checkout creation now sends the visitor's IP address, resolved with Better Auth's getIP and advanced.ipAddress settings. Set customerIpAddress to resolve it yourself or false to stop sending it.
Checkout requests support discount_code, applying it before redirecting or opening embedded checkout; discount codes must be enabled, and discount_id takes precedence.
Fixes and other changes 1
Signup customers are created after Better Auth inserts the user, with the user ID included in the initial Polar request; rejected before-create hooks skip Polar calls.