getCustomerCreateParams not actually being called, but documented in stripe plugin #1142

Closed
opened 2026-03-13 08:24:45 -05:00 by GiteaMirror · 4 comments
Owner

Originally created by @MarcMogdanz on GitHub (Apr 30, 2025).

Is this suited for github?

  • Yes, this is suited for github

To Reproduce

Use the stripe plugin and add a logging statement in getCustomerCreateParams. When creating a stripe customer it won't invoke the function.

Current vs. Expected behavior

Creating a new customer in stripe does currently not use the getCustomerCreateParams function even though it is documented.

What version of Better Auth are you using?

1.2.7

Provide environment information

-

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

Backend

Auth config (if applicable)

import { betterAuth } from "better-auth"

export const auth = betterAuth({
  emailAndPassword: {  
    enabled: true
  },
  stripe({
    // properly setup stripe
    stripeClient,
    stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,

    // dummy console.log
    getCustomerCreateParams: async ({ user }) => {
      console.log('user', user);

      return {
        metadata: {
          foo: "bar"
        },
      };
   },
});

Additional context

seems not to be called anywhere in the code base: https://grep.app/search?f.repo=better-auth%2Fbetter-auth&q=getCustomerCreateParams

documentation: https://www.better-auth.com/docs/plugins/stripe#customer-management

Originally created by @MarcMogdanz on GitHub (Apr 30, 2025). ### Is this suited for github? - [x] Yes, this is suited for github ### To Reproduce Use the stripe plugin and add a logging statement in `getCustomerCreateParams`. When creating a stripe customer it won't invoke the function. ### Current vs. Expected behavior Creating a new customer in stripe does currently not use the `getCustomerCreateParams` function even though it is documented. ### What version of Better Auth are you using? 1.2.7 ### Provide environment information ```bash - ``` ### Which area(s) are affected? (Select all that apply) Backend ### Auth config (if applicable) ```typescript import { betterAuth } from "better-auth" export const auth = betterAuth({ emailAndPassword: { enabled: true }, stripe({ // properly setup stripe stripeClient, stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!, // dummy console.log getCustomerCreateParams: async ({ user }) => { console.log('user', user); return { metadata: { foo: "bar" }, }; }, }); ``` ### Additional context seems not to be called anywhere in the code base: https://grep.app/search?f.repo=better-auth%2Fbetter-auth&q=getCustomerCreateParams documentation: https://www.better-auth.com/docs/plugins/stripe#customer-management
Author
Owner

@dosubot[bot] commented on GitHub (Jul 30, 2025):

Hi, @MarcMogdanz. I'm Dosu, and I'm helping the better-auth team manage their backlog and am marking this issue as stale.

Issue Summary

  • You reported that the getCustomerCreateParams function in the Better Auth Stripe plugin is documented but not called during customer creation in version 1.2.7.
  • You verified this by adding logging inside the function, which never triggered, indicating it is unused in the backend.
  • No further comments or updates have been made on this issue since your report.

Next Steps

  • Please let me know if this issue is still relevant with the latest version of the better-auth repository by commenting here.
  • If I do not hear back within 7 days, this issue will be automatically closed.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jul 30, 2025): Hi, @MarcMogdanz. I'm [Dosu](https://dosu.dev), and I'm helping the better-auth team manage their backlog and am marking this issue as stale. **Issue Summary** - You reported that the `getCustomerCreateParams` function in the Better Auth Stripe plugin is documented but not called during customer creation in version 1.2.7. - You verified this by adding logging inside the function, which never triggered, indicating it is unused in the backend. - No further comments or updates have been made on this issue since your report. **Next Steps** - Please let me know if this issue is still relevant with the latest version of the better-auth repository by commenting here. - If I do not hear back within 7 days, this issue will be automatically closed. Thank you for your understanding and contribution!
Author
Owner

@blaconix commented on GitHub (Sep 25, 2025):

Still happens in the latest version. Can we please get this reopened?

@blaconix commented on GitHub (Sep 25, 2025): Still happens in the latest version. Can we please get this reopened?
Author
Owner

@oliwerhelsen commented on GitHub (Sep 29, 2025):

Yeah same for me. Using Better-auth version: 1.3.23.

@oliwerhelsen commented on GitHub (Sep 29, 2025): Yeah same for me. Using Better-auth version: 1.3.23.
Author
Owner

@ebalo55 commented on GitHub (Oct 1, 2025):

Unless you really need node (npm/yarn/pnpm) I strongly suggest you move to bun, this way you can patch dependencies in a repeatable way as i did.

Patch for bun users

  • create the file named patches/@better-auth%2Fstripe@1.3.24.patch (my version of the package is 1.3.24, if yours is different change that value)
  • paste the following diff in the patch file
diff --git a/dist/index.cjs b/dist/index.cjs
index 1ec58b68a831e8afaf7920f85d975a4ee30d80b2..506fe3080f14cc8ac58020d19e1760866fca07df 100644
--- a/dist/index.cjs
+++ b/dist/index.cjs
@@ -1314,12 +1314,20 @@ const stripe = (options) => {
               create: {
                 async after(user, ctx2) {
                   if (ctx2 && options.createCustomerOnSignUp) {
+                    let options_override = {};
+                    if (options.getCustomerCreateParams) {
+                      options_override = await options.getCustomerCreateParams(
+                        { user, session: null },
+                        ctx2,
+                      );
+                    }
                     const stripeCustomer = await client.customers.create({
                       email: user.email,
                       name: user.name,
                       metadata: {
                         userId: user.id
-                      }
+                      },
+                      ...options_override
                     });
                     await ctx2.context.internalAdapter.updateUser(user.id, {
                       stripeCustomerId: stripeCustomer.id
diff --git a/dist/index.mjs b/dist/index.mjs
index 4282b2aac36bacbcd385747ee178caf58fe3b52a..64c8df123f8590625f1e1fd009b15a56e6991c72 100644
--- a/dist/index.mjs
+++ b/dist/index.mjs
@@ -1298,12 +1298,20 @@ const stripe = (options) => {
               create: {
                 async after(user, ctx2) {
                   if (ctx2 && options.createCustomerOnSignUp) {
+                    let options_override = {};
+                    if (options.getCustomerCreateParams) {
+                    	options_override = await options.getCustomerCreateParams(
+                    		{ user, session: null },
+                    		ctx2,
+                    	);
+                    }
                     const stripeCustomer = await client.customers.create({
                       email: user.email,
                       name: user.name,
                       metadata: {
                         userId: user.id
-                      }
+                      },
+                      ...options_override
                     });
                     await ctx2.context.internalAdapter.updateUser(user.id, {
                       stripeCustomerId: stripeCustomer.id
  • update your root package.json adding the following lines (update the versions accordingly to yours, as before):
{
    // your JSON stuff here
    "patchedDependencies": {
        "@better-auth/stripe@1.3.24": "patches/@better-auth%2Fstripe@1.3.24.patch"
    }
}
  • clear your node_modules and install everything again via bun i, this should automatically apply the patches to the index.cjs and index.mjs files (the .mjs file was enough for me, but for completion I've patched also the commonJS one)

This patch will enable the usage of the getCustomerCreateParams method, working with the admin plugin and all other functionalities related to user creations too.

@ebalo55 commented on GitHub (Oct 1, 2025): Unless you really need `node` (npm/yarn/pnpm) I strongly suggest you move to `bun`, this way you can patch dependencies in a repeatable way as i did. ### Patch for `bun` users - create the file named `patches/@better-auth%2Fstripe@1.3.24.patch` (my version of the package is 1.3.24, if yours is different change that value) - paste the following diff in the patch file ```diff diff --git a/dist/index.cjs b/dist/index.cjs index 1ec58b68a831e8afaf7920f85d975a4ee30d80b2..506fe3080f14cc8ac58020d19e1760866fca07df 100644 --- a/dist/index.cjs +++ b/dist/index.cjs @@ -1314,12 +1314,20 @@ const stripe = (options) => { create: { async after(user, ctx2) { if (ctx2 && options.createCustomerOnSignUp) { + let options_override = {}; + if (options.getCustomerCreateParams) { + options_override = await options.getCustomerCreateParams( + { user, session: null }, + ctx2, + ); + } const stripeCustomer = await client.customers.create({ email: user.email, name: user.name, metadata: { userId: user.id - } + }, + ...options_override }); await ctx2.context.internalAdapter.updateUser(user.id, { stripeCustomerId: stripeCustomer.id diff --git a/dist/index.mjs b/dist/index.mjs index 4282b2aac36bacbcd385747ee178caf58fe3b52a..64c8df123f8590625f1e1fd009b15a56e6991c72 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -1298,12 +1298,20 @@ const stripe = (options) => { create: { async after(user, ctx2) { if (ctx2 && options.createCustomerOnSignUp) { + let options_override = {}; + if (options.getCustomerCreateParams) { + options_override = await options.getCustomerCreateParams( + { user, session: null }, + ctx2, + ); + } const stripeCustomer = await client.customers.create({ email: user.email, name: user.name, metadata: { userId: user.id - } + }, + ...options_override }); await ctx2.context.internalAdapter.updateUser(user.id, { stripeCustomerId: stripeCustomer.id ``` - update your root `package.json` adding the following lines (update the versions accordingly to yours, as before): ```json5 { // your JSON stuff here "patchedDependencies": { "@better-auth/stripe@1.3.24": "patches/@better-auth%2Fstripe@1.3.24.patch" } } ``` - clear your node_modules and install everything again via `bun i`, this should automatically apply the patches to the `index.cjs` and `index.mjs` files (the `.mjs` file was enough for me, but for completion I've patched also the commonJS one) This patch will enable the usage of the `getCustomerCreateParams` method, working with the admin plugin and all other functionalities related to user creations too.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/better-auth#1142