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.
2 Replies
auth.ts
is it supposed to not automatically update the user in db?
Invalid ~~~~~~~~
periodEnd: new Date("Invalid Date"),
seats: 1
}
})
Invalid value for argument
db[getModelName(model)].update()
invocation in
/Users/mayanktripathi/Projects/adam/prod/bv-prod/.next/server/chunks/58a27_better-auth_dist77281df6..js:3150:62
3147 }
3148 const whereClause = convertWhereClause(model, where);
3149 const transformed = transformInput(update, model, "update");
→ 3150 const result = await db[getModelName(model)].update({
where: {
id: "cus_S5ZkzLrh2oHinN"
},
data: {
plan: "pro",
stripeSubscriptionId: "sub_1RBPxKLW6jnevwpozuutGeB4",
status: "active",
periodStart: new Date("Invalid Date"),
periodStart
: Provided Date object is invalid. Expected Date.
getting this now
https://docs.stripe.com/changelog/basil/2025-03-31/deprecate-subscription-current-period-start-and-end
I will probably open a PR for this
Stripe deprecated the current_period_start and current_period_end fields on the subscriptions API on March 31, 2025, and instead, you should use the current_period_start and current_period_end fields on the items[] field.GitHub
Fix stripe webhook handler by Evy04 · Pull Request #2173 · better...
Temp fix for #2171
Not sure if multiple items needs to be handled, since sub will likely not have multiple