accounts/**
This commit is contained in:
parent
63b59de1d5
commit
80fe23b1cb
|
@ -7,9 +7,10 @@ const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const authorization = req.headers.authorization; // authorization header from request
|
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({
|
const session = await stripe.billingPortal.sessions.create({
|
||||||
customer: stripeCustomerId,
|
customer: user.stripeCustomerId,
|
||||||
return_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`,
|
return_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Reference in New Issue