diff --git a/server.js b/server.js index bbbddf1..a6257ad 100644 --- a/server.js +++ b/server.js @@ -4325,10 +4325,10 @@ app.post("/public/portal/:token/budget/:id/checkout", async (req, res) => { }); // B) WEBHOOK DE STRIPE (El chivatazo invisible que avisa cuando el cliente YA ha pagado) -app.post("/webhook/stripe", express.raw({ type: 'application/json' }), async (req, res) => { +app.post("/webhook/stripe", async (req, res) => { try { - const body = req.body; - const event = JSON.parse(body); + // 🛑 FIX: Como usamos express.json() globalmente arriba, el body YA es un objeto, no hay que parsearlo. + const event = req.body; if (event.type === 'checkout.session.completed') { const session = event.data.object;