Argument `stripeCustomerId` is missing.
I'm getting the following error:
This happens when I try to register in my application with the createCustomerOnSignUp option enabled in the Stripe plugin. I have already run the database migration, but the error still persists.
Solution:Jump to solution
BA probably creates the stripe customer after the user is created in the database not before
17 Replies
My auth config:
What version of BA are you on?
I'm on v1.2.7
@gabriel I'll try to reproduce on my end and let you know how it goes.
did you setup correctly the stripe client?
Im using the default stripe setup from next-forge: https://github.com/haydenbleasel/next-forge/blob/main/packages/payments/index.ts
GitHub
next-forge/packages/payments/index.ts at main · haydenbleasel/next...
Production-grade Turborepo template for Next.js apps. - haydenbleasel/next-forge
Ok
make stripeCustomerId optional in your schema
Solution
BA probably creates the stripe customer after the user is created in the database not before
not probably, for sure it does
@gabriel Can I see your prisma schema that was generated by Better Auth?
he for sure didint make stripeCustomerId optional, thats the only reason i could possible think he gets that error
logically
@🌠kkMihai ⚡ is right — Better Auth is creating the customer after login. I had manually added the stripeCustomerId field based on the plugin's documentation schema. After changing the field to optional, the issue was resolved. Thank you all!

np, happy to help
also
quick question
did you used the BA cli to generated the schema or?
No, I manually added the field just like the documentation

ye makes sense why u got that
@gabriel mark this as resolved
@Ping update the docs to specify stripeCustomerId to be set as optional