const session = await fetch("https://merchant.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,
paymentMethodTypes: methods.filter((method) => method.enabled).map((method) => method.type),
orderId: order.id,
allowedOrigins: ["https://store.example"],
successUrl: "https://store.example/checkout/complete",
cancelUrl: "https://store.example/checkout/cancelled",
metadata: { orderId: order.id },
}),
}).then((result) => result.json());