/api/auth/subscription/upgrade 404 with stripe plugin

hey all- im doing this to create a checkout
const { data, error } = await client.subscription.upgrade({
annual: biAnnual,
plan: 'basic',
successUrl: '/dashboard',
cancelUrl: '/pricing'
});
const { data, error } = await client.subscription.upgrade({
annual: biAnnual,
plan: 'basic',
successUrl: '/dashboard',
cancelUrl: '/pricing'
});
but i'm getting an error saying the /api/auth/subscription/upgrade route does not exist?
4 Replies
sanser
sanserOP2mo ago
how should the stripe schema look, its only added stripeCustomerId in my user table?
Oracle
Oracle2mo ago
hey I had this problem, as well. I had to in the authClient set subscription to true, and do the same in the backend. For reference Frontend
return createAuthClient({
baseURL: baseURL,
plugins: [
stripeClient({
subscription: true,
}),
],
});
return createAuthClient({
baseURL: baseURL,
plugins: [
stripeClient({
subscription: true,
}),
],
});
Backend
stripe({
stripeClient,
stripeWebhookSecret: StripeWebhookKey(),
createCustomerOnSignUp: true,
subscription: {
enabled: true,
plans: [
{
name: "basic",
priceId: "price_id",
limits: {
projects: 5,
storage: 10
}
},
// Add more plans as needed
]
}
})
stripe({
stripeClient,
stripeWebhookSecret: StripeWebhookKey(),
createCustomerOnSignUp: true,
subscription: {
enabled: true,
plans: [
{
name: "basic",
priceId: "price_id",
limits: {
projects: 5,
storage: 10
}
},
// Add more plans as needed
]
}
})
Hope this helps!
sanser
sanserOP2mo ago
thanks so much!! il take a look- is that object subscription object inside the plugin??? i think thats where im going wrong thanks this worked- the docs did not make this clear on where to put the subscription object. i had it outside the plugin
Note
Note2mo ago
When i create the subscription and check the db row, it says status incomplete, and some of the fields are null like the stripeSusbscirptionId, the period start and end, the trial start and end is it normal?

Did you find this page helpful?