76 lines
3.1 KiB
PHP
76 lines
3.1 KiB
PHP
<?php
|
|
|
|
// Setup Merchant Account parameters
|
|
$merchant_account_KeyID = $school_record['merchant_account_key_id'];
|
|
$merchant_account_KeyText = $school_record['merchant_account_key_text'];
|
|
$merchant_account_Currency = $school_record['merchant_account_currency'];
|
|
$merchant_account_OrderDescription = $school_record['merchant_account_order_description'];
|
|
$merchant_account_RecordNum = $trxnum;
|
|
$merchant_account_TimeStamp = time();
|
|
|
|
$host = $currentHOST;
|
|
$host .= "/";
|
|
$returnURL = $host. "thanks.php";
|
|
|
|
|
|
echo("<!-- $merchant_account_Code -->\n");
|
|
echo("<!-- $merchant_account_TimeStamp -->\n");
|
|
echo("<!-- $merchant_account_Currency -->\n");
|
|
|
|
$TRXamount = str_replace(',','',number_format($owing,2));
|
|
|
|
if (strlen($merchant_account_OrderDescription) == 0) $merchant_account_OrderDescription = $school_record['school_name'] . " Order Payment";
|
|
|
|
// Insert your security key ID here
|
|
$gw_merchantKeyId = $merchant_account_KeyID;
|
|
// Insert your security key here
|
|
$gw_merchantKeyText = $merchant_account_KeyText;
|
|
|
|
if (!function_exists('gw_printField')) {
|
|
function gw_printField($name, $value = "") {
|
|
global $gw_merchantKeyText;
|
|
static $fields;
|
|
|
|
// Generate the hash
|
|
if($name == "hash") {
|
|
$stringToHash = implode('|', array_values($fields)) . "|" . $gw_merchantKeyText;
|
|
$value = implode("|", array_keys($fields)) . "|" . md5($stringToHash);
|
|
}
|
|
else {
|
|
$fields[$name] = $value;
|
|
}
|
|
|
|
echo(" <input type=\"hidden\" name=\"$name\" value=\"$value\">\n");
|
|
}
|
|
}
|
|
|
|
|
|
$country = '';
|
|
if ($school_record['country'] == 'Canada') $country = 'CA';
|
|
if ($school_record['country'] == 'USA') $country = 'US';
|
|
|
|
$province = '';
|
|
if (strlen($country)) $province = $school_record['province'];
|
|
|
|
?>
|
|
<form action="https://secure.merchantservicegateway.com/cart/cart.php" method="POST">
|
|
<input type="hidden" name="customer_receipt" value="false">
|
|
<input type="hidden" name="key_id" value="<?php echo($merchant_account_KeyID) ?>">
|
|
<input type="hidden" name="return_method" value="redirect">
|
|
<input type="hidden" name="return_link" value="<?php echo($returnURL) ?>">
|
|
<input type="hidden" name="merchant_defined_field_1" value="<?php echo($user_num) ?>">
|
|
<input type="hidden" name="merchant_defined_field_2" value="<?php echo($trxnum) ?>">
|
|
<input type="hidden" name="first_name" value="<?php echo($_SESSION['UserInfo']['first_name']) ?>">
|
|
<input type="hidden" name="last_name" value="<?php echo($_SESSION['UserInfo']['last_name']) ?>">
|
|
<input type="hidden" name="phone" value="<?php echo($_SESSION['UserInfo']['home_phone']) ?>">
|
|
<input type="hidden" name="email" value="<?php echo($_SESSION['UserInfo']['email']) ?>">
|
|
<input type="hidden" name="country" value="<?php echo($country) ?>">
|
|
<input type="hidden" name="province" value="<?php echo($province) ?>">
|
|
<?php gw_printField("action", "process_fixed"); ?>
|
|
<?php gw_printField("order_description", "$merchant_account_OrderDescription"); ?>
|
|
<?php gw_printField("shipping", "fixed|0.00"); ?>
|
|
<?php gw_printField("amount", "$TRXamount"); ?>
|
|
<?php gw_printField("hash"); ?>
|
|
<input type="submit" name="submit" class='btn btn--primary' value="<?php echo($school_record['merchant_account_button_text']) ?>">
|
|
</form>
|