The following changes were made by the replace_file_content tool to: /root/aadharbot/modules/pay/services/paymentService.js. If relevant, proactively run terminal commands to execute this code for the USER. Don't ask for permission. [diff_block_start] @@ -936,6 +936,16 @@ } } + // Record to successful_payments table for Owner Analytics & Tracking + if (pool) { + await pool.query( + `INSERT INTO successful_payments (user_id, order_id, serial_number, amount, plan_type, utr, created_at) + VALUES ($1, $2, $3, $4, $5, $6, NOW()) + ON CONFLICT (order_id) DO NOTHING`, + [payment.userId, payment.orderId, payment.serialNumber, Number(payment.expectedAmount) || 0, payment.planType || 'credits', payment.utr || null] + ).catch(e => console.error('[PAYMENT LOG ERROR]:', e.message)); + } + // CRITICAL FIX: Invalidate cache immediately after payment invalidateUserCache(payment.userId); [diff_block_end] Please note that the above snippet only shows the MODIFIED lines from the last change. It shows up to 3 lines of unchanged lines before and after the modified lines. The actual file contents may have many more lines not shown.