Actualizar server.js
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user