#max-third-vibes_api
1 messages · Page 1 of 1 (latest)
👋 Welcome to your new thread!
⏲️ We'll be here soon! Typically we respond in a few minutes, but sometimes we might take a bit longer if the server is busy or if you have a particularly tricky question.
⏱️ We close idle threads, which makes them read-only. Once a thread is closed it won't be reopened, but you can always start a new thread if you have another question.
🔗 This thread will always be available, even after it's closed. You can find it again using Discord's search, or you can save this link: https://discord.com/channels/841573134531821608/1293951139099840606
📝 Have more to share? Add more details, code, screenshots, videos, etc. below.
this is my API call" // app/api/create-portal-session/route.ts
import { NextResponse } from 'next/server';
import { createClient } from '@supabase/supabase-js';
import Stripe from 'stripe';
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY!, {
apiVersion: '2024-04-10',
});
export async function POST(req: Request) {
const supabase = createClient(
process.env.NEXT_PUBLIC_SUPABASE_URL!,
process.env.SUPABASE_SERVICE_ROLE_KEY!
);
const { user_id } = await req.json(); // Get the user ID from the request
// Fetch the user’s profile from Supabase
const { data: profile } = await supabase
.from('profiles')
.select('stripe_customer_id')
.eq('id', user_id)
.single();
if (!profile || !profile.stripe_customer_id) {
return NextResponse.json({ error: 'No Stripe customer ID found' }, { status: 400 });
}
// Create the Stripe Customer Portal session
const session = await stripe.billingPortal.sessions.create({
customer: profile.stripe_customer_id,
return_url: `${process.env.NEXT_PUBLIC_BASE_URL}/tools/account`,
});
return NextResponse.json({ url: session.url });
}
its just showing an empty dashboard
Can you share the request id for creating the billing portal session? https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support site provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
Fixed! sorry