Updated the env variable naming

This commit is contained in:
Tiago Ribeiro
2023-10-16 09:19:02 +01:00
parent 438ecd2662
commit 15e22f4176
2 changed files with 8 additions and 4 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.STRIPE_SECRET || "", password: ""},
auth: {username: process.env.NEXT_PUBLIC_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.STRIPE_SECRET || "", password: ""},
auth: {username: process.env.NEXT_PUBLIC_STRIPE_SECRET || "", password: ""},
});
const email = idChecker.data["customer_details"]["email"];
const days = productChecker.data["metadata"]["expiry_days"];
await axios.post(process.env.WEBHOOK_URL || "", {days, email, key: process.env.STRIPE_SECRET, checkout: id});
await axios.post(process.env.NEXT_PUBLIC_WEBHOOK_URL || "", {days, email, key: process.env.NEXT_PUBLIC_STRIPE_SECRET, checkout: id});
return Response.json({error: null, ok: true});
} catch (e) {

View File

@@ -10,7 +10,11 @@ export default function PricingTable() {
<Elements stripe={stripePromise}>
<script async src="https://js.stripe.com/v3/pricing-table.js" />
{/** @ts-ignore */}
<stripe-pricing-table id="pricing" pricing-table-id={process.env.STRIPE_PRICING_TABLE} publishable-key={process.env.STRIPE_KEY} />
<stripe-pricing-table
id="pricing"
pricing-table-id={process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE}
publishable-key={process.env.NEXT_PUBLIC_STRIPE_KEY}
/>
</Elements>
);
}