Updated the ENV variables
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.NEXT_PUBLIC_STRIPE_SECRET || "", password: ""},
|
auth: {username: process.env.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.NEXT_PUBLIC_STRIPE_SECRET || "", password: ""},
|
auth: {username: process.env.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.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});
|
return Response.json({error: null, ok: true});
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
|||||||
@@ -4,21 +4,17 @@ import {Elements} from "@stripe/react-stripe-js";
|
|||||||
import {loadStripe} from "@stripe/stripe-js";
|
import {loadStripe} from "@stripe/stripe-js";
|
||||||
import {useEffect} from "react";
|
import {useEffect} from "react";
|
||||||
|
|
||||||
const stripePromise = loadStripe("pk_test_51NzD5xFI67mXFum2XDMXiLu89SbCAMY5O0RnKjlU6XqyfboRVvFHI3f5OJHaxsrjjB7WqDYqN7Y3eF8mq3sF354F00l30L5GuJ");
|
const stripePromise = loadStripe(process.env.STRIPE_KEY || "");
|
||||||
|
|
||||||
export default function PricingTable() {
|
export default function PricingTable() {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE, process.env.NEXT_PUBLIC_STRIPE_KEY);
|
console.log("TESTE");
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Elements stripe={stripePromise}>
|
<Elements stripe={stripePromise}>
|
||||||
<div id={process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE}>
|
<div id={process.env.STRIPE_PRICING_TABLE}>
|
||||||
<stripe-pricing-table
|
<stripe-pricing-table id="pricing" pricing-table-id={process.env.STRIPE_PRICING_TABLE} publishable-key={process.env.STRIPE_KEY} />
|
||||||
id="pricing"
|
|
||||||
pricing-table-id={process.env.NEXT_PUBLIC_STRIPE_PRICING_TABLE}
|
|
||||||
publishable-key={process.env.NEXT_PUBLIC_STRIPE_KEY}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
</Elements>
|
</Elements>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user