new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

Better Auth · Plugins · all subjects

polar/configuration

6 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Polar Access Token environment setup

Create an Organization Access Token in Polar Organization Settings and add it to the environment as POLAR_ACCESS_TOKEN.

Polar plugin server environment option

When creating a Polar SDK client instance, set server to 'sandbox' for the Polar Sandbox environment or 'production' for production. Access tokens, products, and other resources are completely separated between environments and are not interchangeable.

Polar plugin core configuration

The main polar() plugin accepts the following configuration: client (required, Polar SDK client instance), createCustomerOnSignUp (optional, boolean to auto-create Polar customer on signup), getCustomerCreateParams (optional, function to provide additional customer creation metadata), and use (array of sub-plugins).

Polar automatic customer creation on signup

When createCustomerOnSignUp is enabled, a new Polar Customer is automatically created when a new User is added to the Better Auth database. The customer is created with an externalId matching the User ID in the database.

Polar server-side configuration example

Server-side Polar plugin configuration example: import { betterAuth } from "better-auth"; import { polar, checkout, portal, usage, webhooks } from "@polar-sh/better-auth"; import { Polar } from "@polar-sh/sdk"; const polarClient = new Polar({ accessToken: process.env.POLAR_ACCESS_TOKEN, server: 'sandbox' }); const auth = betterAuth({ plugins: [ polar({ client: polarClient, createCustomerOnSignUp: true, use: [ checkout({ products: [{ productId: "123-456-789", slug: "pro" }], successUrl: "/success?checkout_id={CHECKOUT_ID}", authenticatedUsersOnly: true }), portal(), usage(), webhooks({ secret: process.env.POLAR_WEBHOOK_SECRET, onCustomerStateChanged: (payload) => {}, onOrderPaid: (payload) => {}, onPayload: (payload) => {} }) ] }) ] });

Polar client-side configuration

To use Polar on the client side, import createAuthClient from "better-auth/react" and polarClient from "@polar-sh/better-auth/client", then create the auth client with plugins: [polarClient()]. All Polar plugins must be configured on the server side.

Give your agent this brain