Updated the ENV variables

This commit is contained in:
Tiago Ribeiro
2023-10-16 15:40:16 +01:00
parent 9ce8abaec2
commit 563df34517
2 changed files with 7 additions and 11 deletions

View File

@@ -10,7 +10,7 @@ export async function POST(request: Request) {
try {
const idChecker = await axios.get(`https://api.stripe.com/v1/checkout/sessions/${id}`, {
auth: {username: process.env.NEXT_PUBLIC_STRIPE_SECRET || "", password: ""},
auth: {username: process.env.STRIPE_SECRET || "", password: ""},
});
if (idChecker.data["payment_status"] !== "paid") {
@@ -18,14 +18,14 @@ export async function POST(request: Request) {
}
const productChecker = await axios.get(`https://api.stripe.com/v1/products/${product}`, {
auth: {username: process.env.NEXT_PUBLIC_STRIPE_SECRET || "", password: ""},
auth: {username: process.env.STRIPE_SECRET || "", password: ""},
});
const email = idChecker.data["customer_details"]["email"];
const days = productChecker.data["metadata"]["expiry_days"];
await axios.post(process.env.NEXT_PUBLIC_WEBHOOK_URL || "", {days, email, key: process.env.NEXT_PUBLIC_STRIPE_SECRET, checkout: id});
await axios.post(process.env.WEBHOOK_URL || "", {days, email, key: process.env.STRIPE_SECRET, checkout: id});
return Response.json({error: null, ok: true});
} catch (e) {