[GH-ISSUE #4056] Server-side Stripe methods like auth.api.upgradeSubscription not available #27140

Closed
opened 2026-04-17 17:58:32 -05:00 by GiteaMirror · 1 comment
Owner

Originally created by @cesconix on GitHub (Aug 17, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/4056

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Server-side methods related to the Stripe plugin (such as auth.api.upgradeSubscription) are not available or accessible after configuring the Stripe plugin.

Current vs. Expected behavior

Stripe plugin methods should be available on the server side through the auth API, allowing server-side subscription management operations. Current behavior is that auth.api.upgradeSubscription is undefined ma also other expected subscriptions API methods are not accessible.

What version of Better Auth are you using?

1.3.5

System info

System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M2 Pro
  Memory: 174.88 MB / 16.00 GB
  Shell: 5.9 - /bin/zsh
Browsers:
  Chrome: 139.0.7258.128
  Safari: 18.5

Which area(s) are affected? (Select all that apply)

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth";
import { organization } from "better-auth/plugins";
import { stripe } from "@better-auth/stripe";
import { Pool } from "pg";
import Stripe from "stripe";

const stripeClient = new Stripe("API_KEY", {
  apiVersion: "2025-07-30.basil",
  typescript: true,
});

export const auth = betterAuth({
  database: new Pool({
    connectionString: "CONNECTION_STRING",
  }),
  plugins: [
    organization(),
    stripe({
      stripeClient,
      stripeWebhookSecret: "secret",
      createCustomerOnSignUp: true,
    }),
  ],
});

Additional context

No response

Originally created by @cesconix on GitHub (Aug 17, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/4056 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Server-side methods related to the Stripe plugin (such as `auth.api.upgradeSubscription`) are not available or accessible after configuring the Stripe plugin. ### Current vs. Expected behavior Stripe plugin methods should be available on the server side through the auth API, allowing server-side subscription management operations. Current behavior is that `auth.api.upgradeSubscription` is undefined ma also other expected subscriptions API methods are not accessible. ### What version of Better Auth are you using? 1.3.5 ### System info ```bash System: OS: macOS 15.5 CPU: (10) arm64 Apple M2 Pro Memory: 174.88 MB / 16.00 GB Shell: 5.9 - /bin/zsh Browsers: Chrome: 139.0.7258.128 Safari: 18.5 ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth"; import { organization } from "better-auth/plugins"; import { stripe } from "@better-auth/stripe"; import { Pool } from "pg"; import Stripe from "stripe"; const stripeClient = new Stripe("API_KEY", { apiVersion: "2025-07-30.basil", typescript: true, }); export const auth = betterAuth({ database: new Pool({ connectionString: "CONNECTION_STRING", }), plugins: [ organization(), stripe({ stripeClient, stripeWebhookSecret: "secret", createCustomerOnSignUp: true, }), ], }); ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-17 17:58:32 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Aug 17, 2025):

The Stripe plugin's server-side subscription methods (like auth.api.upgradeSubscription) are only exposed if you set the subscription: { enabled: true } option in your Stripe plugin config. Your current config is missing this, so those methods aren't available. Also, make sure that both better-auth and @better-auth/stripe are on the exact same version (e.g., both at 1.3.5); mismatched versions will cause plugin methods to be undefined. After updating your config and versions, clear your node_modules and reinstall dependencies to ensure everything is registered correctly. This pattern has resolved similar issues for other users (example, example).

Here’s how your plugin config should look:

stripe({
  stripeClient,
  stripeWebhookSecret: "secret",
  createCustomerOnSignUp: true,
  subscription: {
    enabled: true,
    // ...other subscription options
  },
})

Once you do this, auth.api.upgradeSubscription and other subscription management methods should be available server-side as expected (plugin code reference).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Chat with Dosu Join Discord Share on X

<!-- gh-comment-id:3194497936 --> @dosubot[bot] commented on GitHub (Aug 17, 2025): <!-- Answer --> The Stripe plugin's server-side subscription methods (like `auth.api.upgradeSubscription`) are only exposed if you set the `subscription: { enabled: true }` option in your Stripe plugin config. Your current config is missing this, so those methods aren't available. Also, make sure that both `better-auth` and `@better-auth/stripe` are on the exact same version (e.g., both at 1.3.5); mismatched versions will cause plugin methods to be undefined. After updating your config and versions, clear your `node_modules` and reinstall dependencies to ensure everything is registered correctly. This pattern has resolved similar issues for other users ([example](https://github.com/better-auth/better-auth/issues/2341), [example](https://github.com/better-auth/better-auth/issues/1717)). Here’s how your plugin config should look: ```typescript stripe({ stripeClient, stripeWebhookSecret: "secret", createCustomerOnSignUp: true, subscription: { enabled: true, // ...other subscription options }, }) ``` Once you do this, `auth.api.upgradeSubscription` and other subscription management methods should be available server-side as expected ([plugin code reference](https://github.com/better-auth/better-auth/blob/efa60af1c2d45a735ed397171bfca513b7e202ca/packages/stripe/src/index.ts)). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/074f4f84-5336-491f-a689-c9cd2e67ea3e?feedback_type=other)</sup>&nbsp;&nbsp;[![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/better-auth/better-auth/issues/4056)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#27140