This commit is contained in:
Karol Wypchlo 2021-03-04 14:48:17 +01:00
parent 33d8eb4dc4
commit f82432f58b
1 changed files with 2 additions and 2 deletions

View File

@ -34,14 +34,14 @@ export default async (req, res) => {
const authorization = req.headers.authorization; // authorization header from request
const user = await got("http://accounts:3000/user", { headers: { authorization } }).json();
console.log(user);
if (isPaidTier(user.tier)) {
const message = `Customer can have only one active subscription at a time, use Stripe Customer Portal to manage active subscription`;
return res.status(StatusCodes.BAD_REQUEST).json({ error: { message } });
}
console.log("ok");
const customer = await getStripeCustomer(user, authorization);
console.log(customer);
const session = await stripe.checkout.sessions.create({