<?php
// Sample webhook payload (replace with your actual sample data)
$samplePayload = '{"eventType": "SUCCESSFUL_TRANSACTION", "eventData": {"product": {"type": "RESERVED_ACCOUNT"}, "paymentReference": "MNFY|96|20240303122807|000090", "amountPaid": 370.00, "customer": {"email": "qqqqq@gmail.com"}, "destinationAccountInformation": {"bankName": "Wema bank", "accountNumber": "3000136439 "}}}';

// Simulate a webhook request using cURL
$webhookUrl = 'https://magadata.com.ng/payment/webhook_handler.php';
$ch = curl_init($webhookUrl);
 
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, $samplePayload);
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);

curl_close($ch);

// Output the response and HTTP code
echo "Response: " . $response . PHP_EOL;
echo "HTTP Code: " . $httpCode . PHP_EOL;
?>
