export async function POST(request: Request) {
const order = await resolveOrder(await request.json());
const response = await fetch("https://merchant-demo.zahlo.eu/api/v1/checkout-sessions", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.ZAHLO_API_KEY!,
"Idempotency-Key": `checkout-${order.id}`,
},
body: JSON.stringify({
mode: "embedded",
amountMinor: order.totalMinor,
currency: order.currency,
orderId: order.id,
allowedOrigins: ["https://store.example"],
}),
});
return Response.json(await response.json(), { status: response.status });
}