<?php
session_start();
include "../include/config.php";

if (isset($_POST['id'])) {
    $paymentId = mysqli_real_escape_string($conn, $_POST['id']);
    
    $deleteQuery = "DELETE FROM association_payment WHERE id = '$paymentId'";
    
    if (mysqli_query($conn, $deleteQuery)) {
        echo json_encode(['success' => true, 'message' => 'Payment deleted successfully']);
    } else {
        echo json_encode(['success' => false, 'message' => mysqli_error($conn)]);
    }
}
?>