HEX
Server: LiteSpeed
System: Linux boring-lehmann.135-181-181-249.plesk.page 4.18.0-553.85.1.el8_10.x86_64 #1 SMP Mon Nov 24 09:05:24 EST 2025 x86_64
User: sethsawariyabizmart._h2dp1nbhkqm (10008)
PHP: 8.3.31
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/sethsawariyabizmart.com/httpdocs/masterAir/masterCheckout/refund-init.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

header("Content-Type: application/json");

include('../cred-config.php');
include('../functions.php');

try {
	$input = json_decode(file_get_contents('php://input'), true);

    // Accept POST data
    $order_id  = $input['order_id'];
    $airpay_id = $input['airpay_id'];
    $amount    = $input['amount'];
	$provider_id = $input['provider_id'];

    // Validate fields
    if (!$order_id || !$airpay_id || !$amount || !$provider_id) {
        echo json_encode([
            "success"  => false,
            "message" => "Missing required fields: order_id, airpay_id, amount, provider_id"
        ], JSON_PRETTY_PRINT);
        exit;
    }

    // Call your API function: response MUST remain stdClass
    $data = refundTxn($order_id, $airpay_id, $amount, $provider_id);

    // Ensure $data is an object (stdClass)
    if (is_array($data)) {
        $data = json_decode(json_encode($data)); 
    }

    // Final JSON response
    echo json_encode([
        "success"  => true,
        "message" => "Refund processed",
        "data"    => $data
    ], JSON_PRETTY_PRINT);

} catch (Exception $e) {
    echo json_encode([
        "success"  => false,
        "message" => $e->getMessage()
    ], JSON_PRETTY_PRINT);
}