<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Help with adding captcha to payment form in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Help-with-adding-captcha-to-payment-form/m-p/95260#M58846</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have an older payment form on a client's website that we inherited. The form collects the basic customer data along with the amount they are going to pay. The form action is a post to 'authorize_sim_send.php'. This seems to be a legacy method, but it has been working fine for the client. We want to add a Captcha to the website form, but I can't seem to get it to work. I can insert the captcha and script and it will display just fine, but I'm at a loss as to the correct code to add to the above referenced file to get it to work. I've added the code below. I appreciate any guidance anyone can provide.&lt;/P&gt;&lt;LI-CODE lang="php"&gt;&amp;lt;?php 

 require_once('config.inc.php');
 require_once('functions.inc.php');
 


 if ( count($_POST) &amp;lt; 1 ) die(';)');
 
 foreach ( $_POST as $k =&amp;gt; $v ){
 	if ( is_array( $v ) ){
 		foreach ( $v as $k1 =&amp;gt; $v1 ){
 			$$k[$k1] = $v1;
 		}
 	}
 	else{
 		$$k = $v;
 	}
 }
 
 // Receive the posted amount and format it as a dollar amount without the currency symbol
 $amount        = number_format(trim($chargetotal,"$"),2);
 // Generate a random sequence number
 $sequence  = rand(1, 1000);
 // Generate a timestamp
 $timestamp    = time();
 // Generate an invoice
 $invoice    = date('YmdHis');
 
 if ( @!session_start() ){
	$mytimeout = 720 * 60; // minutes * 60
	@session_set_cookie_params($mytimeout);

	$sessdir = "/tmp";
	@ini_set('session.save_path', $sessdir);

	@session_cache_expire($mytimeout / 60);
	@ini_set('session.gc_maxlifetime', $mytimeout);
 }
 // Getting Customer ID
 $customer = @session_id();

 // CURL timeout
 $timeout = 30;

 // The following lines generate the SIM fingerprint.  PHP versions 5.1.2 and
 // newer have the necessary hmac function built in.  For older versions, it
 // will try to use the mhash library.
 if( phpversion() &amp;gt;= '5.1.2' )
	$fingerprint = hash_hmac("md5", x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key);
 else
	$fingerprint = bin2hex(mhash(MHASH_MD5, x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key));

 $parms = array();
 
 //$parms['x_ship_to_first_name'] = 
 $parms['x_first_name'] = ( isset( $fname ) &amp;amp;&amp;amp; strlen( trim( $fname ) ) &amp;gt; 0 )? Slug ($fname ) : '';
 //$parms['x_ship_to_last_name'] = 
 $parms['x_last_name'] = ( isset( $fname ) &amp;amp;&amp;amp; strlen( trim( $fname ) ) &amp;gt; 0 )? Slug ($lname ) : '';
 
 $address = "";
 if ( isset( $address1 ) &amp;amp;&amp;amp; strlen( $address1 ) &amp;gt; 0 ){
 	if ( strlen( trim( $address ) ) &amp;gt; 0 ) $address .= ", ";
 	$address .= $address1;
 }
 if ( isset( $address2 ) &amp;amp;&amp;amp; strlen( $address2 ) &amp;gt; 0 ){
 	if ( strlen( trim( $address ) ) &amp;gt; 0 ) $address .= ", ";
 	$address .= $address2;
 }
 //$parms['x_ship_to_address'] = 
 $parms['x_address'] = $address;
 
 //$parms['x_ship_to_city'] = 
 $parms['x_city'] = ( isset( $city ) )? substr( Slug( $city ), 0, 40 ) : '';
 //$parms['x_ship_to_state'] = 
 $parms['x_state'] = ( isset( $state ) )? substr( Slug( $state ), 0, 40 ) : '';
 //$parms['x_ship_to_country'] = 
 $parms['x_country'] = 'US';

 $phone = "";
 if ( isset( $phone1 ) &amp;amp;&amp;amp; strlen( $phone1 ) &amp;gt; 0 ){
 	$phone .= $phone1;
 }
 if ( isset( $phone2 ) &amp;amp;&amp;amp; strlen( $phone2 ) &amp;gt; 0 ){
 	$phone .= $phone2;
 }
 if ( isset( $phone3 ) &amp;amp;&amp;amp; strlen( $phone3 ) &amp;gt; 0 ){
 	$phone .= $phone3;
 }
 $parms['x_phone'] = Slug( $phone );
 
 $parms['x_email'] = ( isset( $email ) )? $email : '';
 
 //$parms['x_ship_to_zip'] = 
 $parms['x_zip'] = ( isset( $zip ) )? $zip : '';
 
 $parms['x_fax'] = ( isset( $fax ) )? $fax : '';
 $parms['x_company'] = ( isset( $company ) )? $company : '';
 
 $description = "";
 if ( isset( $acnumber ) &amp;amp;&amp;amp; strlen( $acnumber ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Account Number: ".$acnumber;
 }
 $mobile = "";
 if ( isset( $mobile1 ) &amp;amp;&amp;amp; strlen( $mobile1 ) &amp;gt; 0 ){
 	$mobile .= $mobile1;
 }
 if ( isset( $mobile2 ) &amp;amp;&amp;amp; strlen( $mobile2 ) &amp;gt; 0 ){
 	$mobile .= $mobile2;
 }
 if ( isset( $mobile3 ) &amp;amp;&amp;amp; strlen( $mobile3 ) &amp;gt; 0 ){
 	$mobile .= $mobile3;
 }
 if ( strlen( $mobile ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Cell Phone: ".$mobile;
 }
 if ( isset( $idate ) &amp;amp;&amp;amp; strlen( $idate ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Invoice Date: ".$idate;
 }
 if ( isset( $iamount ) &amp;amp;&amp;amp; strlen( $iamount ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Invoice Amount: $".number_format(trim($iamount,"$"),2);
 }
 if ( strlen( trim( $description ) ) &amp;lt; 1 ) $description = "No description";
 $parms['x_description'] = $description;
 
 $parms['x_version'] = x_version;
 $parms['x_login'] = x_login;
 $parms['x_amount'] = $amount;
 $parms['x_type'] = x_type;
 $parms['x_method'] = x_method;
 $parms['x_duplicate_window'] = x_duplicate_window;
 $parms['x_cust_id'] = $customer;
 $parms['x_test_request'] = (  stristr( gateway_mode, 'TEST' ) )? 'TRUE' : 'FALSE';
 $parms['x_fp_sequence'] = $sequence;
 $parms['x_fp_hash'] = $fingerprint;
 $parms['x_fp_timestamp'] = $timestamp;
 $parms['x_show_form'] = x_show_form;
 $parms['x_invoice_num'] = $invoice;
 $parms['x_relay_response'] = x_relay_response;
 
 $parms['x_header_html_payment_form'] = ( @file_exists( x_header_html_payment_form ) )? file_get_contents( x_header_html_payment_form ) : '';
 $parms['x_footer_html_payment_form'] = ( @file_exists( x_footer_html_payment_form ) )? file_get_contents( x_footer_html_payment_form ) : '';
 $parms['x_receipt_link_method'] = x_receipt_link_method;
 $parms['x_receipt_link_text'] = x_receipt_link_text;
 $parms['x_receipt_link_url'] = x_receipt_link_url;
 $parms['x_header_html_receipt'] = ( @file_exists( x_header_html_receipt ) )? file_get_contents( x_header_html_receipt ) : '';
 $parms['x_footer_html_receipt'] = ( @file_exists( x_footer_html_receipt ) )? file_get_contents( x_footer_html_receipt ) : '';
 $parms['x_email_customer'] = x_email_customer;
 $parms['x_header_email_receipt'] = ( @file_exists( x_header_email_receipt ) )? file_get_contents( x_header_email_receipt ) : '';
 $parms['x_footer_email_receipt'] = ( @file_exists( x_footer_email_receipt ) )? file_get_contents( x_footer_email_receipt ) : '';
 $parms['x_logo_url'] = x_logo_url;
 $parms['x_color_link'] = x_color_link;
 $parms['x_color_text'] = x_color_text;
 
 $parms['x_customer_ip'] = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 
 $url = ( stristr( gateway_environment, 'TEST' ) )? "https://test.authorize.net/gateway/transact.dll" : "https://secure.authorize.net/gateway/transact.dll";
 
?&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&amp;gt;
&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt;abc.com - Payments&amp;lt;/title&amp;gt;
 &amp;lt;meta name="keywords" content="" /&amp;gt;
 &amp;lt;meta name="description" content="" /&amp;gt;
 &amp;lt;meta name="robots" content="index" /&amp;gt;
 &amp;lt;meta name="robots" content="follow" /&amp;gt;
 &amp;lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body onload="document.forms[0].submit();"&amp;gt;

&amp;lt;FORM NAME="f" METHOD=POST ACTION="&amp;lt;?=$url?&amp;gt;"&amp;gt;

&amp;lt;?php
	 foreach ( $parms as $k =&amp;gt; $v ){
		echo "&amp;lt;INPUT TYPE=HIDDEN NAME=\"$k\" VALUE=\"$v\"&amp;gt;";
	 }
?&amp;gt;

&amp;lt;/FORM&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 21 May 2026 18:19:16 GMT</pubDate>
    <dc:creator>Chrisjc</dc:creator>
    <dc:date>2026-05-21T18:19:16Z</dc:date>
    <item>
      <title>Help with adding captcha to payment form</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Help-with-adding-captcha-to-payment-form/m-p/95260#M58846</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have an older payment form on a client's website that we inherited. The form collects the basic customer data along with the amount they are going to pay. The form action is a post to 'authorize_sim_send.php'. This seems to be a legacy method, but it has been working fine for the client. We want to add a Captcha to the website form, but I can't seem to get it to work. I can insert the captcha and script and it will display just fine, but I'm at a loss as to the correct code to add to the above referenced file to get it to work. I've added the code below. I appreciate any guidance anyone can provide.&lt;/P&gt;&lt;LI-CODE lang="php"&gt;&amp;lt;?php 

 require_once('config.inc.php');
 require_once('functions.inc.php');
 


 if ( count($_POST) &amp;lt; 1 ) die(';)');
 
 foreach ( $_POST as $k =&amp;gt; $v ){
 	if ( is_array( $v ) ){
 		foreach ( $v as $k1 =&amp;gt; $v1 ){
 			$$k[$k1] = $v1;
 		}
 	}
 	else{
 		$$k = $v;
 	}
 }
 
 // Receive the posted amount and format it as a dollar amount without the currency symbol
 $amount        = number_format(trim($chargetotal,"$"),2);
 // Generate a random sequence number
 $sequence  = rand(1, 1000);
 // Generate a timestamp
 $timestamp    = time();
 // Generate an invoice
 $invoice    = date('YmdHis');
 
 if ( @!session_start() ){
	$mytimeout = 720 * 60; // minutes * 60
	@session_set_cookie_params($mytimeout);

	$sessdir = "/tmp";
	@ini_set('session.save_path', $sessdir);

	@session_cache_expire($mytimeout / 60);
	@ini_set('session.gc_maxlifetime', $mytimeout);
 }
 // Getting Customer ID
 $customer = @session_id();

 // CURL timeout
 $timeout = 30;

 // The following lines generate the SIM fingerprint.  PHP versions 5.1.2 and
 // newer have the necessary hmac function built in.  For older versions, it
 // will try to use the mhash library.
 if( phpversion() &amp;gt;= '5.1.2' )
	$fingerprint = hash_hmac("md5", x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key);
 else
	$fingerprint = bin2hex(mhash(MHASH_MD5, x_login . "^" . $sequence . "^" . $timestamp . "^" . $amount . "^", x_transaction_key));

 $parms = array();
 
 //$parms['x_ship_to_first_name'] = 
 $parms['x_first_name'] = ( isset( $fname ) &amp;amp;&amp;amp; strlen( trim( $fname ) ) &amp;gt; 0 )? Slug ($fname ) : '';
 //$parms['x_ship_to_last_name'] = 
 $parms['x_last_name'] = ( isset( $fname ) &amp;amp;&amp;amp; strlen( trim( $fname ) ) &amp;gt; 0 )? Slug ($lname ) : '';
 
 $address = "";
 if ( isset( $address1 ) &amp;amp;&amp;amp; strlen( $address1 ) &amp;gt; 0 ){
 	if ( strlen( trim( $address ) ) &amp;gt; 0 ) $address .= ", ";
 	$address .= $address1;
 }
 if ( isset( $address2 ) &amp;amp;&amp;amp; strlen( $address2 ) &amp;gt; 0 ){
 	if ( strlen( trim( $address ) ) &amp;gt; 0 ) $address .= ", ";
 	$address .= $address2;
 }
 //$parms['x_ship_to_address'] = 
 $parms['x_address'] = $address;
 
 //$parms['x_ship_to_city'] = 
 $parms['x_city'] = ( isset( $city ) )? substr( Slug( $city ), 0, 40 ) : '';
 //$parms['x_ship_to_state'] = 
 $parms['x_state'] = ( isset( $state ) )? substr( Slug( $state ), 0, 40 ) : '';
 //$parms['x_ship_to_country'] = 
 $parms['x_country'] = 'US';

 $phone = "";
 if ( isset( $phone1 ) &amp;amp;&amp;amp; strlen( $phone1 ) &amp;gt; 0 ){
 	$phone .= $phone1;
 }
 if ( isset( $phone2 ) &amp;amp;&amp;amp; strlen( $phone2 ) &amp;gt; 0 ){
 	$phone .= $phone2;
 }
 if ( isset( $phone3 ) &amp;amp;&amp;amp; strlen( $phone3 ) &amp;gt; 0 ){
 	$phone .= $phone3;
 }
 $parms['x_phone'] = Slug( $phone );
 
 $parms['x_email'] = ( isset( $email ) )? $email : '';
 
 //$parms['x_ship_to_zip'] = 
 $parms['x_zip'] = ( isset( $zip ) )? $zip : '';
 
 $parms['x_fax'] = ( isset( $fax ) )? $fax : '';
 $parms['x_company'] = ( isset( $company ) )? $company : '';
 
 $description = "";
 if ( isset( $acnumber ) &amp;amp;&amp;amp; strlen( $acnumber ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Account Number: ".$acnumber;
 }
 $mobile = "";
 if ( isset( $mobile1 ) &amp;amp;&amp;amp; strlen( $mobile1 ) &amp;gt; 0 ){
 	$mobile .= $mobile1;
 }
 if ( isset( $mobile2 ) &amp;amp;&amp;amp; strlen( $mobile2 ) &amp;gt; 0 ){
 	$mobile .= $mobile2;
 }
 if ( isset( $mobile3 ) &amp;amp;&amp;amp; strlen( $mobile3 ) &amp;gt; 0 ){
 	$mobile .= $mobile3;
 }
 if ( strlen( $mobile ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Cell Phone: ".$mobile;
 }
 if ( isset( $idate ) &amp;amp;&amp;amp; strlen( $idate ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Invoice Date: ".$idate;
 }
 if ( isset( $iamount ) &amp;amp;&amp;amp; strlen( $iamount ) &amp;gt; 0 ){
 	if ( strlen( trim( $description ) ) &amp;gt; 0 ) $description .= ", ";
 	$description .= "Invoice Amount: $".number_format(trim($iamount,"$"),2);
 }
 if ( strlen( trim( $description ) ) &amp;lt; 1 ) $description = "No description";
 $parms['x_description'] = $description;
 
 $parms['x_version'] = x_version;
 $parms['x_login'] = x_login;
 $parms['x_amount'] = $amount;
 $parms['x_type'] = x_type;
 $parms['x_method'] = x_method;
 $parms['x_duplicate_window'] = x_duplicate_window;
 $parms['x_cust_id'] = $customer;
 $parms['x_test_request'] = (  stristr( gateway_mode, 'TEST' ) )? 'TRUE' : 'FALSE';
 $parms['x_fp_sequence'] = $sequence;
 $parms['x_fp_hash'] = $fingerprint;
 $parms['x_fp_timestamp'] = $timestamp;
 $parms['x_show_form'] = x_show_form;
 $parms['x_invoice_num'] = $invoice;
 $parms['x_relay_response'] = x_relay_response;
 
 $parms['x_header_html_payment_form'] = ( @file_exists( x_header_html_payment_form ) )? file_get_contents( x_header_html_payment_form ) : '';
 $parms['x_footer_html_payment_form'] = ( @file_exists( x_footer_html_payment_form ) )? file_get_contents( x_footer_html_payment_form ) : '';
 $parms['x_receipt_link_method'] = x_receipt_link_method;
 $parms['x_receipt_link_text'] = x_receipt_link_text;
 $parms['x_receipt_link_url'] = x_receipt_link_url;
 $parms['x_header_html_receipt'] = ( @file_exists( x_header_html_receipt ) )? file_get_contents( x_header_html_receipt ) : '';
 $parms['x_footer_html_receipt'] = ( @file_exists( x_footer_html_receipt ) )? file_get_contents( x_footer_html_receipt ) : '';
 $parms['x_email_customer'] = x_email_customer;
 $parms['x_header_email_receipt'] = ( @file_exists( x_header_email_receipt ) )? file_get_contents( x_header_email_receipt ) : '';
 $parms['x_footer_email_receipt'] = ( @file_exists( x_footer_email_receipt ) )? file_get_contents( x_footer_email_receipt ) : '';
 $parms['x_logo_url'] = x_logo_url;
 $parms['x_color_link'] = x_color_link;
 $parms['x_color_text'] = x_color_text;
 
 $parms['x_customer_ip'] = $HTTP_SERVER_VARS["REMOTE_ADDR"];
 
 $url = ( stristr( gateway_environment, 'TEST' ) )? "https://test.authorize.net/gateway/transact.dll" : "https://secure.authorize.net/gateway/transact.dll";
 
?&amp;gt;

&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&amp;gt;
&amp;lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"&amp;gt;
&amp;lt;head&amp;gt;
 &amp;lt;title&amp;gt;abc.com - Payments&amp;lt;/title&amp;gt;
 &amp;lt;meta name="keywords" content="" /&amp;gt;
 &amp;lt;meta name="description" content="" /&amp;gt;
 &amp;lt;meta name="robots" content="index" /&amp;gt;
 &amp;lt;meta name="robots" content="follow" /&amp;gt;
 &amp;lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body onload="document.forms[0].submit();"&amp;gt;

&amp;lt;FORM NAME="f" METHOD=POST ACTION="&amp;lt;?=$url?&amp;gt;"&amp;gt;

&amp;lt;?php
	 foreach ( $parms as $k =&amp;gt; $v ){
		echo "&amp;lt;INPUT TYPE=HIDDEN NAME=\"$k\" VALUE=\"$v\"&amp;gt;";
	 }
?&amp;gt;

&amp;lt;/FORM&amp;gt;

&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 21 May 2026 18:19:16 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Help-with-adding-captcha-to-payment-form/m-p/95260#M58846</guid>
      <dc:creator>Chrisjc</dc:creator>
      <dc:date>2026-05-21T18:19:16Z</dc:date>
    </item>
  </channel>
</rss>

