accounts/**
This commit is contained in:
parent
8e5e564158
commit
661d1f3275
|
@ -32,13 +32,16 @@ export default async (req, res) => {
|
||||||
// For full details see https://stripe.com/docs/api/checkout/sessions/create
|
// For full details see https://stripe.com/docs/api/checkout/sessions/create
|
||||||
try {
|
try {
|
||||||
const authorization = req.headers.authorization; // authorization header from request
|
const authorization = req.headers.authorization; // authorization header from request
|
||||||
const user = await got(`${process.env.SKYNET_DASHBOARD_URL}/user`, { headers: { authorization } });
|
const user = await got("http://accounts:3000/user", { headers: { authorization } });
|
||||||
|
|
||||||
if (!user.stripeCustomerId) {
|
if (!user.stripeCustomerId) {
|
||||||
const customer = await stripe.customers.create();
|
const customer = await stripe.customers.create();
|
||||||
|
|
||||||
console.log(customer);
|
console.log(customer);
|
||||||
const user = await got.put(`/user`, { json: { stripeCustomerId } });
|
const user = await got.put(`http://accounts:3000/user`, {
|
||||||
|
headers: { authorization },
|
||||||
|
json: { stripeCustomerId },
|
||||||
|
});
|
||||||
console.log(user);
|
console.log(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in New Issue