accounts/**

This commit is contained in:
Karol Wypchlo 2021-02-25 11:39:54 +01:00
parent 63b59de1d5
commit 80fe23b1cb
1 changed files with 3 additions and 2 deletions

View File

@ -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`,
});