// Example API endpoint check router.get('/chat/:bookingId', authenticate, async (req, res) => { const booking = await Booking.findById(req.params.bookingId); if (booking.payment_status !== 'confirmed') { return res.status(403).json({ error: 'Chat locked until payment confirmation' }); } // Proceed with chat data });