accounts/**

This commit is contained in:
Karol Wypchlo 2021-02-25 11:33:57 +01:00
parent b4eb863dc9
commit 4ed19f6535
2 changed files with 4 additions and 2 deletions

View File

@ -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;

View File

@ -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`,