Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG FIX] Fixed a Bug Where active subscriptions from stripe are returning null #318

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

TusharSoni014
Copy link

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:
    image
    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();

Copy link

vercel bot commented Mar 23, 2024

@TusharSoni014 is attempting to deploy a commit to the Vercel Solutions Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant