<?php
include("../classes/manager.class.php");
$m = new Manager();
if (isset($_GET['id'])) {
    $paymentRefId = $_GET['id'];

    // Fetch payment details from the purpayment table
    $paymentDetails = Purpayment::GetPurpaymentSetupById($paymentRefId);

    if ($paymentDetails) {
        // Prepare the response with required fields
        $response = [
            'amount' => $paymentDetails->amount,
            'withholding_tax' => $paymentDetails->withholding_tax,
            'withholding_tax_amount' => $paymentDetails->withholding_tax_amount,
        ];
      console.log(response);


        // Send the response as JSON
        echo json_encode($response);
    } else {
        echo json_encode(['error' => 'Payment details not found.']);
    }
} else {
    echo json_encode(['error' => 'Invalid request.']);
}
?>
