MCPcopy Create free account
hub / github.com/sqlchat/sqlchat / handler

Function handler

src/pages/api/checkout_sessions/[id].ts:9–24  ·  view source on GitHub ↗
(req: NextApiRequest, res: NextApiResponse)

Source from the content-addressed store, hash-verified

7});
8
9export default async function handler(req: NextApiRequest, res: NextApiResponse) {
10 const id: string = req.query.id as string;
11 try {
12 if (!id.startsWith("cs_")) {
13 throw Error("Incorrect CheckoutSession ID.");
14 }
15 const checkout_session: Stripe.Checkout.Session = await stripe.checkout.sessions.retrieve(id, {
16 expand: ["payment_intent"],
17 });
18
19 res.status(200).json(checkout_session);
20 } catch (err) {
21 const errorMessage = err instanceof Error ? err.message : "Internal server error";
22 res.status(500).json({ statusCode: 500, message: errorMessage });
23 }
24}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected