nextjs-subscription-payments
nextjs-subscription-payments copied to clipboard
[BUG FIX] Fixed a Bug Where active subscriptions from stripe are returning null
I modified the supabase table query from the code little bit, to take the current signed in user id and return its current most latest active subscription data from stripe.
- Before:
You can see the subscriptions are returning null from stripe but, i have a subscription active on my stripe
Due to being subscriptions returning null in the frontend, there was no manage button instead of subscribe button on home page, and also the accounts page was also saying you are not subscribed to any subscription, the below query is what i did for both, accounts page and home page to fix the null subscription error,
const { data: subscription, error } = await supabase
.from('subscriptions')
.select('*, prices(*, products(*))')
.eq('user_id', String(user?.id))
.in('status', ['trialing', 'active'])
.order('current_period_end', { ascending: false })
.limit(1)
.single();
@TusharSoni014 is attempting to deploy a commit to the Vercel Solutions Team on Vercel.
A member of the Team first needs to authorize it.