<?php
// Manual webhook call script with signature generation

$webhookUrl = "https://92wingo.fun/pay/lgwebhook.php";

$secret_key = 'mer_685c54cb1f92b';  // apni secret key daalo

$data = [
    "order_sn" => "202508071754583790945951",
    "money" => "1000",
    "status" => "1",
    "pay_time" => date("Y-m-d H:i:s"),
    "msg" => "Payment successful",
    "remark" => "Payment successful",
];

// Signature generate karte hain
$signData = $data;
ksort($signData);

$signString = '';
foreach ($signData as $k => $v) {
    $signString .= "$k=$v&";
}
$signString .= "key=" . $secret_key;

$generatedSign = strtoupper(md5($signString));
$data['sign'] = $generatedSign;

// Curl request
$ch = curl_init($webhookUrl);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);

if (curl_errno($ch)) {
    echo 'Error:' . curl_error($ch);
} else {
    echo 'Response from webhook: ' . $response;
}

curl_close($ch);
?>
