const response = await fetch("https://merchant-demo.zahlo.eu/api/v1/payment-intents", {
method: "POST",
headers: {
"Content-Type": "application/json",
"x-api-key": process.env.ZAHLO_API_KEY,
"Idempotency-Key": `payment-${order.id}`,
},
body: JSON.stringify({
amountMinor: order.totalMinor,
currency: order.currency,
paymentMethodTypes: ["card", "apple_pay", "google_pay"],
customerId: order.customerId,
confirmationMethod: "automatic",
metadata: { orderId: order.id },
}),
});
const intent = await response.json();