better-auth-integration

better-auth-integration is a skill for Claude Code from dodopayments/dodo-agent-plugin. It costs 37 tokens per session (1,771 once invoked), scanned A, a copy of better-auth-integration, MIT.

A coding guide for connecting Better Auth, a JavaScript authentication system, to Dodo Payments. It covers signed-in customers, checkout, subscriptions, usage, portals, and verified webhooks.

In plain words
What is it for?
It helps create Dodo customers at sign-up, start checkout, open customer portals, list payments or subscriptions, submit usage, and receive verified webhook callbacks.
Why use it?
It gives applications a defined way to connect user accounts with payment records and handle payment events safely.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the dodopayments plugin — 17 skills, 2 MCP servers shipped together

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/dodopayments/dodo-agent-plugin/better-auth-integration
Any agent
npx skills add dodopayments/dodo-agent-plugin --skill better-auth-integration
Clone the repo
git clone --depth 1 https://github.com/dodopayments/dodo-agent-plugin

Made for: Claude Code.

Or install dodopayments, the plugin that ships this one along with the rest of its 17 skills, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for better-auth-integration

README.md
[![agentmods](https://agentmods.dev/badge/skills/dodopayments/dodo-agent-plugin/better-auth-integration.svg)](https://agentmods.dev/skills/dodopayments/dodo-agent-plugin/better-auth-integration)
Your own site
<a href="https://agentmods.dev/skills/dodopayments/dodo-agent-plugin/better-auth-integration"><img src="https://agentmods.dev/badge/skills/dodopayments/dodo-agent-plugin/better-auth-integration.svg" alt="Measured on agentmods" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,771 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00037 $0.01771
Opus 5 $0.00018 $0.00886
Sonnet 5 $0.00007 $0.00354
Haiku 4.5 $0.00004 $0.00177

Measured 6d ago against content hash 4e015fa4ed37, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

better-auth-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

100% identical to better-auth-integration — 0 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

plugins/dodopayments/skills/better-auth-integration/SKILL.md · 215 lines

How it starts

The opening of the file, as written. The whole thing — 215 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Better Auth Integration

Use @dodopayments/better-auth to synchronize Better Auth users with Dodo Payments and expose authenticated checkout, customer portal, subscription, payment, usage, and webhook endpoints.

When to use this skill

  • Create a Dodo customer automatically when a Better Auth user signs up.
  • Start checkout for a signed-in user without exposing a Dodo API key.
  • Let users open their customer portal or list their subscriptions and payments.
  • Submit metered usage for the signed-in customer.
  • Receive signature-verified Dodo webhooks through Better Auth.

Install

npm install @dodopayments/better-auth dodopayments better-auth

The package exports the lowercase server functions dodopayments, checkout, portal, usage, and webhooks. Its client entry point exports dodopaymentsClient.

Server setup

Every endpoint is registered by a feature in use. Include every feature that the application calls; omitting one makes its route return 404.

import { betterAuth } from "better-auth";
import DodoPayments from "dodopayments";
import { checkout, dodopayments, portal, usage, webhooks } from "@dodopayments/better-auth";

const dodoPayments = new DodoPayments({
  bearerToken: process.env.DODO_PAYMENTS_API_KEY,
  environment: "test_mode",
});

export const auth = betterAuth({
  database: {
    // your database config
  },
  plugins: [
    dodopayments({
      client: dodoPayments,
      createCustomerOnSignUp: true,
      // `user` here is Better Auth's base user: id, name, email, emailVerified,
      // image, createdAt, updatedAt. Anything else (phone number, company, plan)
      // must first be declared via `user.additionalFields` in your Better Auth
      // config, otherwise it does not exist on the type and will be undefined.
      getCustomerParams: (user) => ({
        metadata: { better_auth_user_id: user.id },
      }),
      use: [
        checkout({
          products: [
            { productId: "pdt_premium", slug: "premium-plan" },
          ],
          successUrl: "https://app.example.com/billing/success",
          authenticatedUsersOnly: true,
        }),
        portal(),
        usage(),
        webhooks({
          webhookKey: process.env.DODO_PAYMENTS_WEBHOOK_KEY,
          onPayload: async (payload) => {
            console.log("Verified Dodo webhook:", payload.type);
          },
        }),
      ],
    }),
  ],
});

Read the full file on GitHub · 215 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 215 lines · 37 tokens per session scan A 4e015fa4ed37

Subscribe to this mod's changes

better-auth-integration is a skill published in the GitHub repository dodopayments/dodo-agent-plugin (6 stars, last pushed 5d ago), licensed MIT. It adds 37 tokens to every session and 1,771 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to better-auth-integration, differing in 0 lines, and is treated as a copy.