From 80fe23b1cb7799351ba91459b5b29dfdb03b928a Mon Sep 17 00:00:00 2001 From: Karol Wypchlo Date: Thu, 25 Feb 2021 11:39:54 +0100 Subject: [PATCH] accounts/** --- packages/dashboard/src/pages/api/stripe/customerPortal.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/dashboard/src/pages/api/stripe/customerPortal.js b/packages/dashboard/src/pages/api/stripe/customerPortal.js index 34a2a67d..d43983a6 100644 --- a/packages/dashboard/src/pages/api/stripe/customerPortal.js +++ b/packages/dashboard/src/pages/api/stripe/customerPortal.js @@ -7,9 +7,10 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY); export default async (req, res) => { try { const authorization = req.headers.authorization; // authorization header from request - const { stripeCustomerId } = await got("http://accounts:3000/user", { headers: { authorization } }); + const user = await got("http://accounts:3000/user", { headers: { authorization } }); + console.log(user); const session = await stripe.billingPortal.sessions.create({ - customer: stripeCustomerId, + customer: user.stripeCustomerId, return_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`, });