Support Services

Secure Web Pay - Checkout PHP

 

<!DOCTYPE html>

<?php function get_UTC_Time()
{
	  date_default_timezone_set("America/Chicago");
	  $unixtime=strtotime(gmdate('Y-m-d H:i:s'));
	  $millitime=microtime(true) * 1000;
	  $utc=number_format(($millitime * 10000) + 621355968000000000 , 0,'.', '');
	  
	  return $utc;
}
      function calculate_HMACMD5_hash($pg_api_login_id,$pg_transaction_type,$pg_version_number,$pg_total_amount,$pg_utc_time,$pg_transaction_order_number,$SecureTransactionKey)
	  {
		$data = $pg_api_login_id ."|". $pg_transaction_type ."|". $pg_version_number ."|". $pg_total_amount ."|". $pg_utc_time ."|". $pg_transaction_order_number;
		echo $data;
		$hash = hash_hmac('md5', $data,$SecureTransactionKey);
		
		return $hash;
	  }
?>

<?php 
         // 
		 // PHP CODE HERE
		 //
		 
		 $pg_api_login_id='xxxxxxxxxxxxxxxxxxxxxxxxxxxx';
		 $pg_transaction_type='13';
		 $pg_version_number="1.0";
		 $pg_total_amount="1.72";
		 $pg_utc_time=get_UTC_Time();
		 $pg_transaction_order_number="98421";
		 $SecureTransactionKey='yyyyyyyyyyyyyyyyyyyyyyyyyy';
		 $pg_ts_hash = calculate_HMACMD5_hash($pg_api_login_id, $pg_transaction_type, $pg_version_number, $pg_total_amount, $pg_utc_time, $pg_transaction_order_number, $SecureTransactionKey);
?>	     

<head>
</head>

<body>



<form method='Redirect' action= 'https://sandbox.paymentsgateway.net/swp/co/default.aspx'><table cellSpacing='0' cellPadding='0' border='0'>

<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_api_login_id' value='<?php echo $pg_api_login_id; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_transaction_type' value='<?php echo $pg_transaction_type; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_version_number' value='<?php echo $pg_version_number; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_total_amount' value='<?php echo $pg_total_amount; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_utc_time' value='<?php echo $pg_utc_time; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_transaction_order_number' value='<?php echo $pg_transaction_order_number; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_ts_hash' value='<?php echo $pg_ts_hash; ?>'/></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_continue_url' value='http://google.com' /></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_return_url' value='https://swp.paymentsgateway.net/Redirect/results.aspx' /></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_return_method' value='AsyncPost' /></td></tr>
<tr><td align='right' width='300'></td><td align='left' width='200'><input type='hidden' name='pg_continue_description' value='GO HOME OR GO NOWHERE!' /></td></tr>









<tr><td align='right' width='300'></td><td align='left' width='200'><INPUT TYPE=SUBMIT value='Pay Now'><br></td></tr></table></form>





</body>

</html>

 

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.