accounts/**
This commit is contained in:
parent
6c60c41ed3
commit
508c207931
|
@ -4,8 +4,6 @@ import { StatusCodes } from "http-status-codes";
|
||||||
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
const stripe = new Stripe(process.env.STRIPE_SECRET_KEY);
|
||||||
|
|
||||||
export default async (req, res) => {
|
export default async (req, res) => {
|
||||||
console.log(req.method);
|
|
||||||
|
|
||||||
if (req.method !== "POST") {
|
if (req.method !== "POST") {
|
||||||
return res.status(StatusCodes.NOT_FOUND).end();
|
return res.status(StatusCodes.NOT_FOUND).end();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +32,6 @@ export default async (req, res) => {
|
||||||
cancel_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`,
|
cancel_url: `${process.env.SKYNET_DASHBOARD_URL}/payments`,
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log(session);
|
|
||||||
|
|
||||||
res.json({ sessionId: session.id });
|
res.json({ sessionId: session.id });
|
||||||
} catch ({ message }) {
|
} catch ({ message }) {
|
||||||
res.status(StatusCodes.BAD_REQUEST).json({ error: { message } });
|
res.status(StatusCodes.BAD_REQUEST).json({ error: { message } });
|
||||||
|
|
|
@ -51,7 +51,7 @@ export default function Payments() {
|
||||||
const stripe = new Stripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);
|
const stripe = new Stripe(process.env.NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY);
|
||||||
await stripe.redirectToCheckout({ sessionId });
|
await stripe.redirectToCheckout({ sessionId });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// todo: handle error
|
console.log(error); // todo: handle error
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in New Issue