diff --git a/packages/dashboard/src/pages/api/stripe/activeSubscription.js b/packages/dashboard/src/pages/api/stripe/activeSubscription.js index 8f7a4e1e..815355d7 100644 --- a/packages/dashboard/src/pages/api/stripe/activeSubscription.js +++ b/packages/dashboard/src/pages/api/stripe/activeSubscription.js @@ -5,7 +5,8 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY); export default async (req, res) => { try { - const stripeCustomerId = "cus_J09ECKPgFEPXoq"; + const authorization = req.headers.authorization; // authorization header from request + const { stripeCustomerId } = await got("http://accounts:3000/user", { headers: { authorization } }); const stripeCustomer = await stripe.customers.retrieve(stripeCustomerId); const { subscriptions } = stripeCustomer; diff --git a/packages/dashboard/src/pages/api/stripe/customerPortal.js b/packages/dashboard/src/pages/api/stripe/customerPortal.js index 836ad173..6e55bdb3 100644 --- a/packages/dashboard/src/pages/api/stripe/customerPortal.js +++ b/packages/dashboard/src/pages/api/stripe/customerPortal.js @@ -5,7 +5,8 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY); export default async (req, res) => { try { - const stripeCustomerId = "cus_J09ECKPgFEPXoq"; + const authorization = req.headers.authorization; // authorization header from request + const { stripeCustomerId } = await got("http://accounts:3000/user", { headers: { authorization } }); const session = await stripe.billingPortal.sessions.create({ customer: stripeCustomerId, return_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`,