Unable to get access to authClient.stripe.subscription
When I do authClient.stripe. it only shows webhook as option?
Also, I dont know why but when user pays for sub, the webhook is not updating the data in db.
import { emailOTPClient } from "better-auth/client/plugins";
import { createAuthClient } from "better-auth/react";
import { stripeClient } from "@better-auth/stripe/client"
export const authClient = createAuthClient({
/** the base url of the server (optional if you're using the same domain) */
baseURL: "http://localhost:3000",
plugins: [
emailOTPClient(),
stripeClient({
subscription: true,
}),
],
});
export const { signIn, signUp, useSession, signOut, stripe } = authClient;db[getModelName(model)].update() invocation inperiodStart: Provided Date object is invalid. Expected Date.db[getModelName(model)].update()periodStartplugins: [
stripe({
stripeClient,
stripeWebhookSecret: process.env.STRIPE_WEBHOOK_SECRET!,
createCustomerOnSignUp: true,
subscription: {
enabled: true,
plans: async () => {
const products = await stripeClient.products.list();
const plans = products.data.map((product) => ({
name: product.name,
priceId: product.default_price as string | undefined,
}));
return plans;
},
},
}),
]