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

autumn/api-methods

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

Autumn attach function for payments

Call the attach function from useCustomer() to redirect the customer to a Stripe checkout page or open AttachDialog if a payment method is already on file, allowing the customer to confirm a new subscription or purchase and handle the payment: await attach({ productId: "pro", dialog: AttachDialog })

Autumn AttachDialog component

The AttachDialog component can be imported from autumn-js/react or downloaded as a shadcn/ui component to customize.

Autumn client-side pricing logic functions

Client-side functions available from useCustomer(): check to see if the customer is allowed to perform an action, track a usage event (typically done server-side), customer to display billing data in UI such as subscriptions and feature balances.

Autumn check function client-side

Use the allowed() method from useCustomer() to check if a customer can perform an action: if (allowed({ featureId: "messages" })) { /* proceed */ }

Autumn refetch customer data

After tracking usage, call refetch() from useCustomer() to update customer usage data and display current feature balance: await refetch();

Autumn server-side check function

Check on the backend if the customer can perform an action using auth.api.check(): const { allowed } = await auth.api.check({ headers: await headers(), body: { featureId: "messages" } });

Autumn server-side track function

Track usage on the server side using auth.api.track(): await auth.api.track({ headers: await headers(), body: { featureId: "messages", value: 2 } });

Autumn openBillingPortal function

Call openBillingPortal() from useCustomer() to open a billing portal where the customer can update their payment method or cancel their plan: await openBillingPortal({ returnUrl: "/settings/billing" });

Autumn cancel function

Call cancel() from useCustomer() to cancel a product or subscription: await cancel({ productId: "pro" });

Autumn useCustomer expand parameter

Pass an expand parameter to useCustomer() to get additional information. Supported expand options are: invoices, trials_used, payment_method, rewards. Example: useCustomer({ expand: ["invoices"] })

Autumn customer data structure

The customer object contains: name, email, features (with individual feature objects containing balance), subscriptions, and optionally invoices and payment method data when expanded.

Give your agent this brain