[GH-ISSUE #6465] Stripe Billing Portal 404 Not Found #19154

Closed
opened 2026-04-15 17:57:30 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @emileindik on GitHub (Dec 2, 2025).
Original GitHub issue: https://github.com/better-auth/better-auth/issues/6465

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Call billingPortal() on your UI client.

const { data, error } = await authClient.subscription.billingPortal();

I'm using the default server path /api/auth/

Image

Current vs. Expected behavior

Expected to get URL to user's billing portal.

What version of Better Auth are you using?

1.4.4

System info

"npx @better-auth/cli info --json" threw error.
Normal macbook pro, Node v23

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

Client

Auth config (if applicable)

import { stripe } from "@better-auth/stripe";
import Stripe from "stripe";

const stripeClient = new Stripe(config.stripeSecretKey, {
    apiVersion: "2025-11-17.clover", // Latest API version as of Stripe SDK v20.0.0
});

export const auth = betterAuth({
    database: new pg.Pool({
        user: config.authDbUser,
        password: config.authDbPassword,
        host: config.authDbHost,
        port: config.authDbPort,
    }),
    socialProviders: {
        google: {
            clientId: config.googleClientId,
            clientSecret: config.googleClientSecret,
        },
    },
    plugins: [
        stripe({
            stripeClient,
            stripeWebhookSecret: config.stripeWebhookSecret,
            createCustomerOnSignUp: true,
        }),
...

Additional context

No response

Originally created by @emileindik on GitHub (Dec 2, 2025). Original GitHub issue: https://github.com/better-auth/better-auth/issues/6465 ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Call `billingPortal()` on your UI client. ``` const { data, error } = await authClient.subscription.billingPortal(); ``` I'm using the default server path `/api/auth/` <img width="837" height="80" alt="Image" src="https://github.com/user-attachments/assets/7fe609e6-09f9-42c5-82ce-804529c2a99f" /> ### Current vs. Expected behavior Expected to get URL to user's billing portal. ### What version of Better Auth are you using? 1.4.4 ### System info ```bash "npx @better-auth/cli info --json" threw error. Normal macbook pro, Node v23 ``` ### Which area(s) are affected? (Select all that apply) Client ### Auth config (if applicable) ```typescript import { stripe } from "@better-auth/stripe"; import Stripe from "stripe"; const stripeClient = new Stripe(config.stripeSecretKey, { apiVersion: "2025-11-17.clover", // Latest API version as of Stripe SDK v20.0.0 }); export const auth = betterAuth({ database: new pg.Pool({ user: config.authDbUser, password: config.authDbPassword, host: config.authDbHost, port: config.authDbPort, }), socialProviders: { google: { clientId: config.googleClientId, clientSecret: config.googleClientSecret, }, }, plugins: [ stripe({ stripeClient, stripeWebhookSecret: config.stripeWebhookSecret, createCustomerOnSignUp: true, }), ... ``` ### Additional context _No response_
GiteaMirror added the locked label 2026-04-15 17:57:30 -05:00
Author
Owner

@better-auth-agent[bot] commented on GitHub (Dec 2, 2025):

Hi there! Thanks for reporting the billing portal 404 issue. Here are some troubleshooting steps to try out:

• Verify that your Stripe plugin configuration is up to date and that your Stripe client is using a supported API version. Sometimes a change or mismatch there can lead to endpoint issues.

• Double-check that the billing portal endpoint is correctly configured on both your client and server. In some cases, the route might be misconfigured or not properly registered due to a version mismatch.

• Review your logs for any additional error details from either the Better Auth backend or Stripe itself. This can offer hints on whether the issue lies within our routing or from Stripe’s API response.

If you continue to experience this issue, tag @better-auth-agent if you would like an answer from the Agent. Is there any additional detail (for example, error logs or timing) that might help narrow this down further?

If you need more help, tag @Skyvern in a comment so I can respond.

DiagramDiscordGitHub

Diagram Join Star

<!-- gh-comment-id:3600104331 --> @better-auth-agent[bot] commented on GitHub (Dec 2, 2025): Hi there! Thanks for reporting the billing portal 404 issue. Here are some troubleshooting steps to try out: • Verify that your Stripe plugin configuration is up to date and that your Stripe client is using a supported API version. Sometimes a change or mismatch there can lead to endpoint issues. • Double-check that the billing portal endpoint is correctly configured on both your client and server. In some cases, the route might be misconfigured or not properly registered due to a version mismatch. • Review your logs for any additional error details from either the Better Auth backend or Stripe itself. This can offer hints on whether the issue lies within our routing or from Stripe’s API response. If you continue to experience this issue, tag @better-auth-agent if you would like an answer from the Agent. Is there any additional detail (for example, error logs or timing) that might help narrow this down further? _If you need more help, tag @Skyvern in a comment so I can respond._ <!-- bot:webhook reply v1 --> [Diagram](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) • [Discord](https://discord.gg/fG2XXEuQX3) • [GitHub](https://github.com/Skyvern-AI/Skyvern) [![Diagram](https://img.shields.io/badge/Diagram-2b3137?style=flat-square)](https://repodiagrams.s3.eu-north-1.amazonaws.com/skyvern_ultra_detailed_interactive.html) [![Join](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&style=flat-square)](https://discord.gg/fG2XXEuQX3) [![Star](https://img.shields.io/badge/star-181717?logo=github&logoColor=white&style=flat-square)](https://github.com/Skyvern-AI/Skyvern)
Author
Owner

@dosubot[bot] commented on GitHub (Dec 2, 2025):

Hi @emileindik! I'm Dosu and I’m helping the better-auth team.

The 404 error happens because the billingPortal() client method defaults to a GET request, but the backend expects POST. To fix this, call it like this:

const { data, error } = await authClient.subscription.billingPortal({
  fetchOptions: { method: "POST" }
});

This is a known limitation—there’s currently no built-in way to make the client use POST for this action without the manual override [source].

If you still get a 404 after using POST, double-check that the Stripe plugin is included in both your server and client configs, both better-auth and @better-auth/stripe are on the same version, and that your plugin config uses subscription (not subscriptions) and has enabled: true [source]. If the problem persists, check your server logs to see if the endpoint is being registered at runtime.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

<!-- gh-comment-id:3600109177 --> @dosubot[bot] commented on GitHub (Dec 2, 2025): <!-- Greeting --> Hi @emileindik! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the better-auth team. <!-- Answer --> The 404 error happens because the billingPortal() client method defaults to a GET request, but the backend expects POST. To fix this, call it like this: ```js const { data, error } = await authClient.subscription.billingPortal({ fetchOptions: { method: "POST" } }); ``` This is a known limitation—there’s currently no built-in way to make the client use POST for this action without the manual override [[source](https://github.com/better-auth/better-auth/issues/4611)]. If you still get a 404 after using POST, double-check that the Stripe plugin is included in both your server and client configs, both better-auth and @better-auth/stripe are on the same version, and that your plugin config uses subscription (not subscriptions) and has enabled: true [[source](https://github.com/better-auth/better-auth/issues/4801)]. If the problem persists, check your server logs to see if the endpoint is being registered at runtime. <!-- 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/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/b3c9d919-aeee-45bf-ab89-892cd4d23549?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/cdda13d9-dd27-4d31-b09a-5d8bec92de21/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20404%20error%20happens%20because%20the%20billingPortal%28%29%20client%20method%20defaults%20to%20a%20GET%20request%2C%20but%20the%20backend%20expects%20POST.%20To%20fix%20this%2C%20call%20it%20like%20this%3A%0A%0A%60%60%60js%0Aconst%20%7B%20data%2C%20error%20%7D%20%3D%20await%20authClient.subscription.billingPortal%28%7B%0A%20%20fetchOptions%3A%20%7B%20method%3A%20%22POST%22%20%7D%0A%7D%29%3B%0A%60%60%60%0A%0AThis%20is%20a%20known%20limitation%E2%80%94there%E2%80%99s%20currently%20no%20built-in%20way%20to%20make%20the%20client%20use%20POST%20for%20this%20action%20without%20the%20manual%20override%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/4611%29%5D.%0A%0AIf%20you%20still%20get%20a%20404%20after%20using%20POST%2C%20double-check%20that%20the%20Stripe%20plugin%20is%20included%20in%20both%20your%20server%20and%20client%20configs%2C%20both%20better-auth%20and%20%40better-auth/stripe%20are%20on%20the%20same%20version%2C%20and%20that%20your%20plugin%20config%20uses%20subscription%20%28not%20subscriptions%29%20and%20has%20enabled%3A%20true%20%5B%5Bsource%5D%28https%3A//github.com/better-auth/better-auth/issues/4801%29%5D.%20If%20the%20problem%20persists%2C%20check%20your%20server%20logs%20to%20see%20if%20the%20endpoint%20is%20being%20registered%20at%20runtime.)&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/6465)
Author
Owner

@emileindik commented on GitHub (Dec 2, 2025):

Needed to enable subscription on server and client!

<!-- gh-comment-id:3600158716 --> @emileindik commented on GitHub (Dec 2, 2025): Needed to enable subscription on server and client!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#19154