Updated the env variable naming
This commit is contained in:
@@ -10,7 +10,7 @@ export async function POST(request: Request) {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const idChecker = await axios.get(`https://api.stripe.com/v1/checkout/sessions/${id}`, {
|
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") {
|
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}`, {
|
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 email = idChecker.data["customer_details"]["email"];
|
||||||
|
|
||||||
const days = productChecker.data["metadata"]["expiry_days"];
|
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});
|
return Response.json({error: null, ok: true});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -10,7 +10,11 @@ export default function PricingTable() {
|
|||||||
<Elements stripe={stripePromise}>
|
<Elements stripe={stripePromise}>
|
||||||
<script async src="https://js.stripe.com/v3/pricing-table.js" />
|
<script async src="https://js.stripe.com/v3/pricing-table.js" />
|
||||||
{/** @ts-ignore */}
|
{/** @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>
|
</Elements>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user