Stripe integration plugin for Better Auth.
// Source: https://github.com/better-auth/better-auth | License: MIT | Copyright 2024 - present, Bereket Engida
// Provided via justclaw.it.com; keep this notice with the code.
import type { BetterAuthPlugin, User } from "better-auth";
import { APIError } from "better-auth";
import type { Organization } from "better-auth/plugins/organization";
import { defu } from "defu";
import type Stripe from "stripe";
import { STRIPE_ERROR_CODES } from "./error-codes";
import { customerMetadata } from "./metadata";
import {
cancelSubscription,
createBillingPortal,
listActiveSubscriptions,
restoreSubscription,
stripeWebhook,
subscriptionSuccess,
upgradeSubscription,
} from "./routes";
import { getSchema } from "./schema";
import type {
StripeOptions,
StripePlan,
Subscription,
WithStripeCustom
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key