13 lines
438 B
JavaScript
13 lines
438 B
JavaScript
import { createCheckoutSession } from './stripeModel.js';
|
|
|
|
export async function createCheckoutSessionController(req, res) {
|
|
try {
|
|
const body = req.body;
|
|
const sessionId = await createCheckoutSession(body);
|
|
res.json({ id: sessionId });
|
|
} catch (error) {
|
|
console.error("Error creating checkout session:", error);
|
|
res.status(500).json({ error: "Failed to create checkout session" });
|
|
}
|
|
}
|