<?php
echo 'Method Not Allowed';
die();
require_once 'paymentGateway/paygate/payGatePaymentGateway.php';

$data = [
    'gatewayConfig' => '{"paygateId":"1049051100011","encryptionKey":"xdFOscCyGNUI","currencyCode":"BWP","customField1":"enza","reference":"STU-00ss1"}',
    'reference'   => 'ORD20250416',
    'amount'      => 10000, // in cents
    'currency'    => 'ZAR',
    'email'       => 'jane.doe@example.com',
    'locale'      => 'en-za',
    'country'     => 'ZAF',    
];

$gateway = new PayGatePaymentGateway();
$response = $gateway->createOrder($data);

print_r($response);
// Output form for redirection
echo '<form action="' . $response['action_url'] . '" method="post">';
foreach ($response['form_fields'] as $key => $value) {
    echo '<input type="hidden" name="' . htmlspecialchars($key) . '" value="' . htmlspecialchars($value) . '">';
}
echo '<button type="submit">Proceed to Payment</button>';
echo '</form>';
