<?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 Re: Convert from AIM to CIM in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33388#M17904</link>
    <description>&lt;P&gt;I'm not sure but I commented out the send () function to see if that would effect it. But it didn't. Seems the build() function not triggering. It might not get any response from the function error($Response)&lt;/P&gt;</description>
    <pubDate>Thu, 07 Mar 2013 15:08:35 GMT</pubDate>
    <dc:creator>mallen</dc:creator>
    <dc:date>2013-03-07T15:08:35Z</dc:date>
    <item>
      <title>Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33291#M17813</link>
      <description>&lt;P&gt;I have this cart and it uses the AIM method. I need to use the CIM.&amp;nbsp; Searching through allthe files there is only one file called Authorize.net.php&amp;nbsp; Below is the code on this page.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php

class AuthorizeNet extends GatewayFramework implements GatewayModule {

	var $cards = array("visa", "mc", "amex", "disc", "jcb", "dc");

	var $liveurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;
	var $testurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;

	function AuthorizeNet () {
		parent::__construct();
		$this-&amp;gt;setup('login','password','testmode');
	}

	function actions () {
		add_action('mycart_process_order',array(&amp;amp;$this,'process'));
	}

	function process () {
		$transaction = $this-&amp;gt;build();
		$Response = $this-&amp;gt;send($transaction);
		if ($Response-&amp;gt;code == '1') { // success
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'CHARGED');
			return;
		} elseif ($Response-&amp;gt;code == '4') { // flagged for merchant review or risk management
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'PENDING');
			return;
		} else $this-&amp;gt;error($Response);
	}

	function txnid ($Response) {
		if (empty($Response-&amp;gt;transactionid)) return parent::txnid();
		return $Response-&amp;gt;transactionid;
	}

	function error ($Response) {
		return new MycartError($Response-&amp;gt;reason,'authorize_net_error',MYCART_TRXN_ERR,
			array('code'=&amp;gt;$Response-&amp;gt;reasoncode));
	}

	function build () {
		$Order = $this-&amp;gt;Order;
		$_ = array();

		// Options
		$_['x_test_request']		= ($this-&amp;gt;settings['testmode'] == "on")?"TRUE":"FALSE"; // Set "TRUE" while testing
		$_['x_login'] 				= $this-&amp;gt;settings['login'];
		$_['x_password'] 			= $this-&amp;gt;settings['password'];
		$_['x_Delim_Data'] 			= "TRUE";
		$_['x_Delim_Char'] 			= ",";
		$_['x_Encap_Char'] 			= "";
		$_['x_version'] 			= "3.1";
		$_['x_relay_response']		= "FALSE";
		$_['x_type'] 				= "AUTH_ONLY";
		//= "AUTH_CAPTURE";
		$_['x_method']				= "CC";
		$_['x_email_customer']		= "FALSE";
		$_['x_merchant_email']		= $this-&amp;gt;settings['merchant_email'];

		// Required Fields
		$_['x_amount']				= $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;total;
		$_['x_customer_ip']			= $_SERVER["REMOTE_ADDR"];
		$_['x_fp_sequence']			= mktime();
		$_['x_fp_timestamp']		= time();
		// $_['x_fp_hash']				= hash_hmac("md5","{$_['x_login']}^{$_['x_fp_sequence']}^{$_['x_fp_timestamp']}^{$_['x_amount']}",$_['x_password']);

		// Customer Contact
		$_['x_first_name']			= $Order-&amp;gt;Customer-&amp;gt;firstname;
		$_['x_last_name']			= $Order-&amp;gt;Customer-&amp;gt;lastname;
		$_['x_email']				= $Order-&amp;gt;Customer-&amp;gt;email;
		$_['x_phone']				= $Order-&amp;gt;Customer-&amp;gt;phone;

		// Billing
		$_['x_card_num']			= $Order-&amp;gt;Billing-&amp;gt;card;
		$_['x_exp_date']			= date("my",$Order-&amp;gt;Billing-&amp;gt;cardexpires);
		$_['x_card_code']			= $Order-&amp;gt;Billing-&amp;gt;cvv;
		$_['x_address']				= $Order-&amp;gt;Billing-&amp;gt;address;
		$_['x_city']				= $Order-&amp;gt;Billing-&amp;gt;city;
		$_['x_state']				= $Order-&amp;gt;Billing-&amp;gt;state;
		$_['x_zip']					= $Order-&amp;gt;Billing-&amp;gt;postcode;
		$_['x_country']				= $Order-&amp;gt;Billing-&amp;gt;country;

		// Shipping
		$_['x_ship_to_first_name']  = $Order-&amp;gt;Customer-&amp;gt;firstname;
		$_['x_ship_to_last_name']	= $Order-&amp;gt;Customer-&amp;gt;lastname;
		$_['x_ship_to_address']		= $Order-&amp;gt;Shipping-&amp;gt;address;
		$_['x_ship_to_city']		= $Order-&amp;gt;Shipping-&amp;gt;city;
		$_['x_ship_to_state']		= $Order-&amp;gt;Shipping-&amp;gt;state;
		$_['x_ship_to_zip']			= $Order-&amp;gt;Shipping-&amp;gt;postcode;
		$_['x_ship_to_country']		= $Order-&amp;gt;Shipping-&amp;gt;country;

		// Transaction
		$_['x_freight']				= $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;shipping;
		$_['x_tax']					= $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;tax;

		// Line Items
		$i = 1;
		foreach($Order-&amp;gt;Cart-&amp;gt;contents as $Item) {
			$_['x_line_item'][] = ($i++)."&amp;lt;|&amp;gt;".substr($Item-&amp;gt;name,0,31)."&amp;lt;|&amp;gt;".((sizeof($Item-&amp;gt;options) &amp;gt; 1)?" (".substr($Item-&amp;gt;option-&amp;gt;label,0,253).")":"")."&amp;lt;|&amp;gt;".(int)$Item-&amp;gt;quantity."&amp;lt;|&amp;gt;".number_format($Item-&amp;gt;unitprice,$this-&amp;gt;precision,'.','')."&amp;lt;|&amp;gt;".(($Item-&amp;gt;tax)?"Y":"N");
		}

		return $this-&amp;gt;encode($_);
	}

	function send ($data) {
		if ($this-&amp;gt;settings['testmode'] == "on") $url = $this-&amp;gt;testurl;
		else $url = $this-&amp;gt;liveurl;
		$url = apply_filters('mycart_authorize_net_url',$url);
		return $this-&amp;gt;response(parent::send($data,$url));
	}

	function response ($buffer) {
		$_ = new stdClass();

		list($_-&amp;gt;code,
			 $_-&amp;gt;subcode,
			 $_-&amp;gt;reasoncode,
			 $_-&amp;gt;reason,
			 $_-&amp;gt;authcode,
			 $_-&amp;gt;avs,
			 $_-&amp;gt;transactionid,
			 $_-&amp;gt;invoicenum,
			 $_-&amp;gt;description,
			 $_-&amp;gt;amount,
			 $_-&amp;gt;method,
			 $_-&amp;gt;type,
			 $_-&amp;gt;customerid,
			 $_-&amp;gt;firstname,
			 $_-&amp;gt;lastname,
			 $_-&amp;gt;company,
			 $_-&amp;gt;address,
			 $_-&amp;gt;city,
			 $_-&amp;gt;state,
			 $_-&amp;gt;zip,
			 $_-&amp;gt;country,
			 $_-&amp;gt;phone,
			 $_-&amp;gt;fax,
			 $_-&amp;gt;email,
			 $_-&amp;gt;ship_to_first_name,
			 $_-&amp;gt;ship_to_last_name,
			 $_-&amp;gt;ship_to_company,
			 $_-&amp;gt;ship_to_address,
			 $_-&amp;gt;ship_to_city,
			 $_-&amp;gt;ship_to_state,
			 $_-&amp;gt;ship_to_zip,
			 $_-&amp;gt;ship_to_country,
			 $_-&amp;gt;tax,
			 $_-&amp;gt;duty,
			 $_-&amp;gt;freight,
			 $_-&amp;gt;taxexempt,
			 $_-&amp;gt;ponum,
			 $_-&amp;gt;md5hash,
			 $_-&amp;gt;cvv2code,
			 $_-&amp;gt;cvv2response) = explode(",",$buffer);
		return $_;
	}

	function settings () {
		$this-&amp;gt;ui-&amp;gt;cardmenu(0,array(
			'name' =&amp;gt; 'cards',
			'selected' =&amp;gt; $this-&amp;gt;settings['cards']
		),$this-&amp;gt;cards);

		$this-&amp;gt;ui-&amp;gt;text(1,array(
			'name' =&amp;gt; 'login',
			'value' =&amp;gt; $this-&amp;gt;settings['login'],
			'size' =&amp;gt; '16',
			'label' =&amp;gt; __('Enter your AuthorizeNet Login ID.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;password(1,array(
			'name' =&amp;gt; 'password',
			'value' =&amp;gt; $this-&amp;gt;settings['password'],
			'size' =&amp;gt; '24',
			'label' =&amp;gt; __('Enter your AuthorizeNet Password or Transaction Key.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;checkbox(1,array(
			'name' =&amp;gt; 'testmode',
			'checked' =&amp;gt; $this-&amp;gt;settings['testmode'],
			'label' =&amp;gt; __('Enable test mode','Mycart')
		));

	}

} // END class AuthorizeNet

?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;I was thinking I need to add the XML part to this page. Somehow to have it parse the XML.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;PRE&gt;//build xml to post
$content =
	"&amp;lt;?xml version=\"1.0\" encoding=\"utf-8\"?&amp;gt;" .
	"&amp;lt;createCustomerProfileTransactionRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"&amp;gt;" .
	//MerchantAuthenticationBlock().
	"&amp;lt;transaction&amp;gt;".
	"&amp;lt;profileTransAuthOnly&amp;gt;".
	"&amp;lt;amount&amp;gt;" . $_['x_amount'] . "&amp;lt;/amount&amp;gt;". // should include tax, shipping, and everything.
	"&amp;lt;shipping&amp;gt;".
	"&amp;lt;amount&amp;gt;&amp;lt;/amount&amp;gt;".
	"&amp;lt;name&amp;gt;Free Shipping&amp;lt;/name&amp;gt;".
	"&amp;lt;description&amp;gt;Free UPS Ground shipping. Ships in 5-10 days.&amp;lt;/description&amp;gt;".
	"&amp;lt;/shipping&amp;gt;".
	"&amp;lt;lineItems&amp;gt;". $_['x_amount'] ."&amp;lt;/lineItems&amp;gt;".
	//"&amp;lt;unitPrice&amp;gt;" . ($_POST["amount"] - 1.00) . "&amp;lt;/unitPrice&amp;gt;".
	"&amp;lt;customerProfileId&amp;gt;12711484&amp;lt;/customerProfileId&amp;gt;".
	"&amp;lt;customerPaymentProfileId&amp;gt;11714901&amp;lt;/customerPaymentProfileId&amp;gt;".
	"&amp;lt;customerShippingAddressId&amp;gt;11804938&amp;lt;/customerShippingAddressId&amp;gt;".
	"&amp;lt;order&amp;gt;".
	"&amp;lt;invoiceNumber&amp;gt;INV12345&amp;lt;/invoiceNumber&amp;gt;".
	"&amp;lt;/order&amp;gt;".
	"&amp;lt;/profileTransAuthOnly&amp;gt;".
	"&amp;lt;/transaction&amp;gt;".
	"&amp;lt;/createCustomerProfileTransactionRequest&amp;gt;";

echo "Raw request: " . htmlspecialchars($content) . "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;";
$response = send_xml_request($content);
echo "Raw response: " . htmlspecialchars($response) . "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;";
$parsedresponse = parse_api_response($response);
if ("Ok" == $parsedresponse-&amp;gt;messages-&amp;gt;resultCode) {
	echo "A transaction was successfully created for customerProfileId &amp;lt;b&amp;gt;"
		. htmlspecialchars($_POST["customerProfileId"])
		. "&amp;lt;/b&amp;gt;.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;";
}
if (isset($parsedresponse-&amp;gt;directResponse)) {
	echo "direct response: &amp;lt;br&amp;gt;"
		. htmlspecialchars($parsedresponse-&amp;gt;directResponse)
		. "&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;";
		
	$directResponseFields = explode(",", $parsedresponse-&amp;gt;directResponse);
	$responseCode = $directResponseFields[0]; // 1 = Approved 2 = Declined 3 = Error
	$responseReasonCode = $directResponseFields[2]; // See &lt;A target="_blank" href="http://www.authorize.net/support/AIM_guide.pdf"&gt;http://www.authorize.net/support/AIM_guide.pdf&lt;/A&gt;
	$responseReasonText = $directResponseFields[3];
	$approvalCode = $directResponseFields[4]; // Authorization code
	$transId = $directResponseFields[6];
	
	if ("1" == $responseCode) echo "The transaction was successful.&amp;lt;br&amp;gt;";
	else if ("2" == $responseCode) echo "The transaction was declined.&amp;lt;br&amp;gt;";
	else echo "The transaction resulted in an error.&amp;lt;br&amp;gt;";
	
	echo "responseReasonCode = " . htmlspecialchars($responseReasonCode) . "&amp;lt;br&amp;gt;";
	echo "responseReasonText = " . htmlspecialchars($responseReasonText) . "&amp;lt;br&amp;gt;";
	echo "approvalCode = " . htmlspecialchars($approvalCode) . "&amp;lt;br&amp;gt;";
	echo "transId = " . htmlspecialchars($transId) . "&amp;lt;br&amp;gt;";
}

echo "&amp;lt;br&amp;gt;&amp;lt;a href=index.php?customerProfileId=" 
	. urlencode($_POST["customerProfileId"])
	. "&amp;amp;customerPaymentProfileId="
	. urlencode($_POST["customerPaymentProfileId"])
	. "&amp;amp;customerShippingAddressId="
	. urlencode($_POST["customerShippingAddressId"])
	. "&amp;gt;Continue&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;";&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2013 14:34:26 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33291#M17813</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-01T14:34:26Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33295#M17817</link>
      <description>&lt;P&gt;This is what I have now. I can't find how to convert the posted values. I get error : "Authorize.net malformed"&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php

require ('/lib/shared/AuthorizeNetRequest.php');
require ('/lib/shared/AuthorizeNetTypes.php');
require ('/lib/shared/AuthorizeNetXMLResponse.php');
require ('/lib/shared/AuthorizeNetResponse.php');
require ('/lib/AuthorizeNetAIM.php');
require ('/lib/AuthorizeNetCIM.php');

require_once("/XML/util.php"); 
require_once("/XML/vars.php"); 

//require ('AuthorizeNetCIM.php');
 

class AuthorizeNet extends GatewayFramework implements GatewayModule {

	var $cards = array("visa", "mc", "amex", "disc", "jcb", "dc");

	var $liveurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;
	var $testurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;
	
	function AuthorizeNet () {
		parent::__construct();
		$this-&amp;gt;setup('login','password','testmode');
	}

	function actions () {
		add_action('mycart_process_order',array(&amp;amp;$this,'process'));
	}

	function process () {
		$transaction = $this-&amp;gt;build();
		$Response = $this-&amp;gt;send($transaction);
		if ($Response-&amp;gt;code == '1') { // success
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'CHARGED');
			return;
		} elseif ($Response-&amp;gt;code == '4') { // flagged for merchant review or risk management
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'PENDING');
			return;
		} else $this-&amp;gt;error($Response);
	}

	function txnid ($Response) {
		if (empty($Response-&amp;gt;transactionid)) return parent::txnid();
		return $Response-&amp;gt;transactionid;
	}

	function error ($Response) {
		return new MycartError($Response-&amp;gt;reason,'authorize_net_error',MYCART_TRXN_ERR,
			array('code'=&amp;gt;$Response-&amp;gt;reasoncode));
	}

	function build () {
		$Order = $this-&amp;gt;Order;
		$_ = array();

		// Options
		$_['x_test_request']		= ($this-&amp;gt;settings['testmode'] == "on")?"TRUE":"FALSE"; // Set "TRUE" while testing
		$_['x_login'] 				= $this-&amp;gt;settings['login'];
		$_['x_password'] 			= $this-&amp;gt;settings['password'];
		$_['x_Delim_Data'] 			= "TRUE";
		
	    $amount	= $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;total;
		
		

		// Shipping
		//$Order-&amp;gt;Customer-&amp;gt;firstname;
		//$$Order-&amp;gt;Customer-&amp;gt;lastname;
		//$Order-&amp;gt;Shipping-&amp;gt;address;
		//$Order-&amp;gt;Shipping-&amp;gt;city;
		//$Order-&amp;gt;Shipping-&amp;gt;state;
		//$Order-&amp;gt;Shipping-&amp;gt;postcode;
		//Order-&amp;gt;Shipping-&amp;gt;country;

		// Transaction
		//$Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;shipping;
		//$Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;tax;

	}



	/**function send ($data) {
		if ($this-&amp;gt;settings['testmode'] == "on") $url = $this-&amp;gt;testurl;
		else $url = $this-&amp;gt;liveurl;
		$url = apply_filters('mycart_authorize_net_url',$url);
		return $this-&amp;gt;response(parent::send($data,$url));
}
	**/
	

	function settings () {
		$this-&amp;gt;ui-&amp;gt;cardmenu(0,array(
			'name' =&amp;gt; 'cards',
			'selected' =&amp;gt; $this-&amp;gt;settings['cards']
		),$this-&amp;gt;cards);

		$this-&amp;gt;ui-&amp;gt;text(1,array(
			'name' =&amp;gt; 'login',
			'value' =&amp;gt; $this-&amp;gt;settings['login'],
			'size' =&amp;gt; '16',
			'label' =&amp;gt; __('Enter your AuthorizeNet Login ID.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;password(1,array(
			'name' =&amp;gt; 'password',
			'value' =&amp;gt; $this-&amp;gt;settings['password'],
			'size' =&amp;gt; '24',
			'label' =&amp;gt; __('Enter your AuthorizeNet Password or Transaction Key.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;checkbox(1,array(
			'name' =&amp;gt; 'testmode',
			'checked' =&amp;gt; $this-&amp;gt;settings['testmode'],
			'label' =&amp;gt; __('Enable test mode','Mycart')
		));

	}


	

} // END class AuthorizeNet

// Create Auth &amp;amp; Capture Transaction
$request = new AuthorizeNetCIM;
$customerProfileId = "1274411484";
$customerPaymentProfileId = "1171444901";
$customerShippingAddressId = "1144804938";
$transaction = new AuthorizeNetTransaction;
$transaction-&amp;gt;amount = $amount;
$transaction-&amp;gt;customerProfileId = $customerProfileId;
$transaction-&amp;gt;customerPaymentProfileId = $paymentProfileId;
$transaction-&amp;gt;customerShippingAddressId = $customerAddressId;   
$lineItem              = new AuthorizeNetLineItem;
$lineItem-&amp;gt;itemId      = "4";
$lineItem-&amp;gt;name        = "Cookies";
$lineItem-&amp;gt;description = "Chocolate Chip";
$lineItem-&amp;gt;quantity    = "4";
$lineItem-&amp;gt;unitPrice   = "1.00";
$lineItem-&amp;gt;taxable     = "true";

$transaction-&amp;gt;lineItems[] = $lineItem;
$transaction-&amp;gt;lineItems[] = $lineItem2;
    
    
$response = $request-&amp;gt;createCustomerProfileTransaction("AuthCapture", $transaction);
$transactionResponse = $response-&amp;gt;getTransactionResponse();
$transactionId = $transactionResponse-&amp;gt;transaction_id;
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2013 17:05:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33295#M17817</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-01T17:05:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33300#M17822</link>
      <description>&lt;P&gt;Is this correct? I figured since the customer id exists in the online CIM I could declare it. Pull the customer Profile ID from that.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;$request = new AuthorizeNetCIM;
$customerId = "12346";


$response = $request-&amp;gt;getCustomerProfileIds();

$transaction = new AuthorizeNetTransaction;

$transaction-&amp;gt;customerProfileId = $customerProfileId;
$transaction-&amp;gt;customerPaymentProfileId = $paymentProfileId;
$transaction-&amp;gt;customerShippingAddressId = $customerAddressId;   
$transaction-&amp;gt;amount = $amount;
$lineItem              = new AuthorizeNetLineItem;
$lineItem-&amp;gt;itemId      = "4";
$lineItem-&amp;gt;name        = "Cookies";
$lineItem-&amp;gt;description = "Chocolate Chip";
$lineItem-&amp;gt;quantity    = "4";
$lineItem-&amp;gt;unitPrice   = "1.00";
$lineItem-&amp;gt;taxable     = "true";

$transaction-&amp;gt;lineItems[] = $lineItem;

    
    
$response = $request-&amp;gt;createCustomerProfileTransaction("AuthCapture", $transaction);
$transactionResponse = $response-&amp;gt;getTransactionResponse();
$transactionId = $transactionResponse-&amp;gt;transaction_id;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 01 Mar 2013 21:49:32 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33300#M17822</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-01T21:49:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33306#M17826</link>
      <description>&lt;P&gt;I keep getting I the error : "Authorize.net malformed" I turned on my errors in php.ini to see if I could get more details. Please help.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 14:57:47 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33306#M17826</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-04T14:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33307#M17827</link>
      <description>&lt;P&gt;The XML is malformed. echo out the xml and see if it match what is in the documentation.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 15:05:32 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33307#M17827</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-04T15:05:32Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33308#M17828</link>
      <description>&lt;P&gt;I'm not sure how to echo what the XML is.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 15:52:24 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33308#M17828</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-04T15:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33310#M17830</link>
      <description>&lt;P&gt;I tried &amp;lt;?php echo ($status_response-&amp;gt;xml); ?&amp;gt;&amp;nbsp; but didn't work.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 16:09:50 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33310#M17830</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-04T16:09:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33313#M17833</link>
      <description>&lt;P&gt;I realized I was trying to send form data to a customer profile that already existed. So I attempted to create a new profile and transaction. This is what I have now and still not working.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php

require ('/lib/shared/AuthorizeNetRequest.php');
require ('/lib/shared/AuthorizeNetTypes.php');
require ('/lib/shared/AuthorizeNetXMLResponse.php');
require ('/lib/shared/AuthorizeNetResponse.php');
require ('/lib/AuthorizeNetAIM.php');
require ('/lib/AuthorizeNetCIM.php');

include_once ("XML/util.php"); 
include_once ("XML/vars.php"); 

//require ('AuthorizeNetCIM.php');
 

class AuthorizeNet extends GatewayFramework implements GatewayModule {

	var $cards = array("visa", "mc", "amex", "disc", "jcb", "dc");

	var $liveurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;
	var $testurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway/transact.dll';"&gt;https://secure.authorize.net/gateway/transact.dll';&lt;/A&gt;
	
	
	function AuthorizeNet () {
		parent::__construct();
		$this-&amp;gt;setup('login','password','testmode');
	}

	function actions () {
		add_action('mycart_process_order',array(&amp;amp;$this,'process'));
	}

	function process () {
		$transaction = $this-&amp;gt;build();
		$Response = $this-&amp;gt;send($transaction);
		if ($Response-&amp;gt;code == '1') { // success
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'CHARGED');
			return;
		} elseif ($Response-&amp;gt;code == '4') { // flagged for merchant review or risk management
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'PENDING');
			return;
		} else $this-&amp;gt;error($Response); 
	}


	function txnid ($Response) {
		if (empty($Response-&amp;gt;transactionid)) return parent::txnid();
		return $Response-&amp;gt;transactionid;
	}

	function error ($Response) {
		return new MycartError($Response-&amp;gt;reason,'authorize_net_error',MYCART_TRXN_ERR,
			array('code'=&amp;gt;$Response-&amp;gt;reasoncode));
	}

	function build () {
		$Order = $this-&amp;gt;Order;
		$_ = array();

		// Options
		$_['x_test_request']		= ($this-&amp;gt;settings['testmode'] == "on")?"TRUE":"FALSE"; // Set "TRUE" while testing
		$_['x_login'] 				= $this-&amp;gt;settings['login'];
		$_['x_password'] 			= $this-&amp;gt;settings['password'];
		$_['x_Delim_Data'] 			= "TRUE";
		
	    //$amount	= $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;total;
		$amount = $Mycart-&amp;gt;Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;total;
		
		// Line Items
		$i = 1;
		foreach($Order-&amp;gt;Cart-&amp;gt;contents as $Item) {
			$_['x_line_item'][] = ($i++)."&amp;lt;|&amp;gt;".substr($Item-&amp;gt;name,0,31)."&amp;lt;|&amp;gt;".((sizeof($Item-&amp;gt;options) &amp;gt; 1)?" (".substr($Item-&amp;gt;option-&amp;gt;label,0,253).")":"")."&amp;lt;|&amp;gt;".(int)$Item-&amp;gt;quantity."&amp;lt;|&amp;gt;".number_format($Item-&amp;gt;unitprice,$this-&amp;gt;precision,'.','')."&amp;lt;|&amp;gt;".(($Item-&amp;gt;tax)?"Y":"N");
		}

		return $this-&amp;gt;encode($_);
	

// Create Auth &amp;amp; Capture Transaction
$request = new AuthorizeNetCIM;

$customerProfile = new AuthorizeNetCustomer;
$customerProfile-&amp;gt;description = "Description of customer here";
$customerProfile-&amp;gt;merchantCustomerId = 987;
$customerProfile-&amp;gt;email = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;email;

//create and add payment profiles and addresses

// Add payment profile.
$paymentProfile = new AuthorizeNetPaymentProfile;
$paymentProfile-&amp;gt;customerType = "individual";
$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;cardNumber = $Mycart-&amp;gt;Order-&amp;gt;Billing-&amp;gt;card;
$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;expirationDate = date("my",$Mycart-&amp;gt;Order-&amp;gt;Billing-&amp;gt;cardexpires);
$customerProfile-&amp;gt;paymentProfiles[] = $paymentProfile;

//Add a Shipping Address

$address = new AuthorizeNetAddress;
$address-&amp;gt;firstName = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;firstname;
$address-&amp;gt;lastName = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;lasttname;
$address-&amp;gt;company = "John Doe Company";
$address-&amp;gt;address = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;address;
$address-&amp;gt;city = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;city;
$address-&amp;gt;state = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;state;
$address-&amp;gt;zip = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;postcode;
$address-&amp;gt;country = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;country;
$address-&amp;gt;phoneNumber = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;phone;
$address-&amp;gt;faxNumber = "";
$response = $request-&amp;gt;createCustomerShippingAddress($customerProfileId, $address);
$customerAddressId = $response-&amp;gt;getCustomerAddressId();

//create the transaction
$transaction = new AuthorizeNetTransaction;
$transaction-&amp;gt;customerProfileId = $customerProfileId;
$transaction-&amp;gt;customerPaymentProfileId = $paymentProfileId;
$transaction-&amp;gt;customerShippingAddressId = $customerAddressId;   
$transaction-&amp;gt;amount = $amount;
$lineItem              = new AuthorizeNetLineItem;
$transaction-&amp;gt;lineItems[] = $lineItem;  
    
$response = $request-&amp;gt;createCustomerProfileTransaction("AuthCapture", $transaction);
$transactionResponse = $response-&amp;gt;getTransactionResponse();
$transactionId = $transactionResponse-&amp;gt;transaction_id;


	}

	function send ($data) {
		if ($this-&amp;gt;settings['testmode'] == "on") $url = $this-&amp;gt;testurl;
		else $url = $this-&amp;gt;liveurl;
		$url = apply_filters('mycart_authorize_net_url',$url);
		return $this-&amp;gt;response(parent::send($data,$url));
}

function response ($buffer) {
		$_ = new stdClass();

		list($_-&amp;gt;code,
			 $_-&amp;gt;subcode,
			 $_-&amp;gt;reasoncode,
			 $_-&amp;gt;reason,
			 $_-&amp;gt;authcode,
			 $_-&amp;gt;avs,
			 $_-&amp;gt;transactionid,
			 $_-&amp;gt;invoicenum,
			 $_-&amp;gt;description,
			 $_-&amp;gt;amount,
			 $_-&amp;gt;method,
			 $_-&amp;gt;type,
			 $_-&amp;gt;customerid,
			 $_-&amp;gt;firstname,
			 $_-&amp;gt;lastname,
			 $_-&amp;gt;company,
			 $_-&amp;gt;address,
			 $_-&amp;gt;city,
			 $_-&amp;gt;state,
			 $_-&amp;gt;zip,
			 $_-&amp;gt;country,
			 $_-&amp;gt;phone,
			 $_-&amp;gt;fax,
			 $_-&amp;gt;email,
			 $_-&amp;gt;ship_to_first_name,
			 $_-&amp;gt;ship_to_last_name,
			 $_-&amp;gt;ship_to_company,
			 $_-&amp;gt;ship_to_address,
			 $_-&amp;gt;ship_to_city,
			 $_-&amp;gt;ship_to_state,
			 $_-&amp;gt;ship_to_zip,
			 $_-&amp;gt;ship_to_country,
			 $_-&amp;gt;tax,
			 $_-&amp;gt;duty,
			 $_-&amp;gt;freight,
			 $_-&amp;gt;taxexempt,
			 $_-&amp;gt;ponum,
			 $_-&amp;gt;md5hash,
			 $_-&amp;gt;cvv2code,
			 $_-&amp;gt;cvv2response) = explode(",",$buffer);
		return $_;
	}


	function settings () {
		$this-&amp;gt;ui-&amp;gt;cardmenu(0,array(
			'name' =&amp;gt; 'cards',
			'selected' =&amp;gt; $this-&amp;gt;settings['cards']
		),$this-&amp;gt;cards);

		$this-&amp;gt;ui-&amp;gt;text(1,array(
			'name' =&amp;gt; 'login',
			'value' =&amp;gt; $this-&amp;gt;settings['login'],
			'size' =&amp;gt; '16',
			'label' =&amp;gt; __('Enter your AuthorizeNet Login ID.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;password(1,array(
			'name' =&amp;gt; 'password',
			'value' =&amp;gt; $this-&amp;gt;settings['password'],
			'size' =&amp;gt; '24',
			'label' =&amp;gt; __('Enter your AuthorizeNet Password or Transaction Key.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;checkbox(1,array(
			'name' =&amp;gt; 'testmode',
			'checked' =&amp;gt; $this-&amp;gt;settings['testmode'],
			'label' =&amp;gt; __('Enable test mode','Mycart')
		));

	}

} // END class AuthorizeNet
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 19:41:34 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33313#M17833</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-04T19:41:34Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33318#M17838</link>
      <description>&lt;P&gt;I was getting an error that "Your ID or login" is not valid or expired.&lt;/P&gt;&lt;P&gt;I changed the URL to &lt;A target="_blank" href="https://test.authorize.net/gateway/transact.dll"&gt;https://test.authorize.net/gateway/transact.dll&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Now the cart completed the transaction and I get a transaction ID but when I log into Customer Information Manager I don't see any transactions.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Mar 2013 21:52:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33318#M17838</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-04T21:52:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33319#M17839</link>
      <description>&lt;P&gt;CIM XML use&lt;/P&gt;&lt;P&gt;test&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://apitest.authorize.net/xml/v1/request.api"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt;&lt;/P&gt;&lt;P&gt;production&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="https://test.authorize.net/xml/v1/request.api"&gt;https://test.authorize.net/xml/v1/request.api&lt;/A&gt;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;Sound like you are still using AIM, did you see if the transaction in the unsetted transaction?&lt;/DIV&gt;</description>
      <pubDate>Mon, 04 Mar 2013 22:10:35 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33319#M17839</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-04T22:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33334#M17854</link>
      <description>&lt;P&gt;I checked my email and I had all the transactions there. So really all it was doing was sending the amount, getting a transaction ID and sending me an email. But it was not creating any record in CIM.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I looked at my code and realized I had not set the values in the finction that sends the order. So I modified it below. (Sorry the formatting is not good)&amp;nbsp; I also changed the URL to &lt;A target="_blank" href="https://apitest.authorize.net/xml/v1/request.api"&gt;https://apitest.authorize.net/xml/v1/request.api&lt;/A&gt;&amp;nbsp; but I get no error and it just kicks back to my checkout form. Doesn't process like before. The function build () {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;$Order = $this-&amp;gt;Order;&amp;nbsp; look like where the issue is.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php

require ('/lib/shared/AuthorizeNetRequest.php');
require ('/lib/shared/AuthorizeNetTypes.php');
require ('/lib/shared/AuthorizeNetXMLResponse.php');
require ('/lib/shared/AuthorizeNetResponse.php');
require ('/lib/AuthorizeNetAIM.php');
require ('/lib/AuthorizeNetCIM.php');

include_once ("XML/util.php"); 
include_once ("XML/vars.php"); 

//require ('AuthorizeNetCIM.php');
 

class AuthorizeNet extends GatewayFramework implements GatewayModule {

	var $cards = array("visa", "mc", "amex", "disc", "jcb", "dc");

	var $liveurl = '&lt;A target="_blank" href="https://secure.authorize.net/gateway"&gt;https://secure.authorize.net/gateway&lt;/A&gt;
	var $testurl = '&lt;A target="_blank" href="https://test.authorize.net/xml/v1/request.api';"&gt;https://test.authorize.net/xml/v1/request.api';&lt;/A&gt;
	function AuthorizeNet () {
		parent::__construct();
		$this-&amp;gt;setup('login','password','testmode');
	}

	function actions () {
		add_action('mycart_process_order',array(&amp;amp;$this,'process'));
	}

function process () {
		$transaction = $this-&amp;gt;build();
		$Response = $this-&amp;gt;send($transaction);
		if ($Response-&amp;gt;code == '1') { // success
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'CHARGED');
			return;
		} elseif ($Response-&amp;gt;code == '4') { // flagged for merchant review or risk management
			$this-&amp;gt;Order-&amp;gt;transaction($this-&amp;gt;txnid($Response),'PENDING');
			return;
		} else $this-&amp;gt;error($Response); 
	}


	function txnid ($Response) {
		if (empty($Response-&amp;gt;transactionid)) return parent::txnid();
		return $Response-&amp;gt;transactionid;
	}

	function error ($Response) {
		return new MycartError($Response-&amp;gt;reason,'authorize_net_error',MYCART_TRXN_ERR,
			array('code'=&amp;gt;$Response-&amp;gt;reasoncode));
	}

	function build () {
		$Order = $this-&amp;gt;Order;
		//$_ = array();

		// Options
		$_['x_test_request']		= ($this-&amp;gt;settings['testmode'] == "true")?"TRUE":"FALSE"; // Set "TRUE" while testing
		$_['x_login'] 				= $this-&amp;gt;settings['login'];
		$_['x_password'] 			= $this-&amp;gt;settings['password'];
		$_['x_Delim_Data'] 			= "TRUE";
		$_['x_type'] 				= "AUTH_CAPTURE";
	//	= "AUTH_CAPTURE"    AUTH_ONLY;
		$_['x_method']				= "CC";
		$_['x_email_customer']		= "FALSE";
		$_['x_merchant_email']		= $this-&amp;gt;settings['merchant_email'];
		$_['x_customer_ip']			= $_SERVER["REMOTE_ADDR"];
		$_['x_fp_sequence']			= mktime();
		$_['x_fp_timestamp']		= time();
		
		// create Auth &amp;amp; Capture Transaction
		$request = new AuthorizeNetCIM;
		$customerProfile = new AuthorizeNetCustomer;
		$customerProfile-&amp;gt;description = "Description of customer here";
		$customerProfile-&amp;gt;merchantCustomerId = 987;
        //create and add payment profiles and addresses

		// add payment profile.
		$paymentProfile = new AuthorizeNetPaymentProfile;
		$paymentProfile-&amp;gt;customerType = "individual";
		$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;cardNumber = $Mycart-&amp;gt;Order-&amp;gt;Billing-&amp;gt;card;
		$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;expirationDate = date("my",$Mycart-&amp;gt;Order-&amp;gt;Billing-&amp;gt;cardexpires);
		$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;cardCode  = $Mycart-&amp;gt;Order-&amp;gt;Billing-&amp;gt;cvv;
		$customerProfile-&amp;gt;paymentProfiles[] = $paymentProfile;
		$customerProfile-&amp;gt;email = $Order-&amp;gt;Customer-&amp;gt;email;
		
		//add a shipping address
		$address = new AuthorizeNetAddress;
		$address-&amp;gt;firstName = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;firstname;
		$address-&amp;gt;lastName = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;lasttname;
		$address-&amp;gt;company = "John Doe Company";
		$address-&amp;gt;address = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;address;
		$address-&amp;gt;city = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;city;
		$address-&amp;gt;state = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;state;
		$address-&amp;gt;zip = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;postcode;
		$address-&amp;gt;country = $Mycart-&amp;gt;Order-&amp;gt;Shipping-&amp;gt;country;
		$address-&amp;gt;phoneNumber = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;phone;
		$response = $request-&amp;gt;createCustomerShippingAddress($customerProfileId, $address);
		$customerAddressId = $response-&amp;gt;getCustomerAddressId();

		//create the transaction
		$transaction = new AuthorizeNetTransaction;
		$transaction-&amp;gt;customerProfileId = $customerProfileId;
		$transaction-&amp;gt;customerPaymentProfileId = $paymentProfileId;
		$transaction-&amp;gt;customerShippingAddressId = $customerAddressId;   
		$transaction-&amp;gt;amount = $Order-&amp;gt;Cart-&amp;gt;Totals-&amp;gt;total;
		$lineItem = new AuthorizeNetLineItem;
		$transaction-&amp;gt;lineItems[] = $lineItem;  
    
		$response = $request-&amp;gt;createCustomerProfileTransaction("AuthCapture", $transaction);
		$transactionResponse = $response-&amp;gt;getTransactionResponse();
		$transactionId = $transactionResponse-&amp;gt;transaction_id;
		
		
		// Line Items
		$i = 1;
		foreach($Order-&amp;gt;Cart-&amp;gt;contents as $Item) {
		$transaction-&amp;gt;lineItems[] = ($i++)."&amp;lt;|&amp;gt;".substr($Item-&amp;gt;name,0,31)."&amp;lt;|&amp;gt;".((sizeof($Item-&amp;gt;options) &amp;gt; 1)?" (".substr($Item-&amp;gt;option-&amp;gt;label,0,253).")":"")."&amp;lt;|&amp;gt;".(int)$Item-&amp;gt;quantity."&amp;lt;|&amp;gt;".number_format($Item-&amp;gt;unitprice,$this-&amp;gt;precision,'.','')."&amp;lt;|&amp;gt;".(($Item-&amp;gt;tax)?"Y":"N");
		
		}

		return $this-&amp;gt;encode($_);
	


//$customerProfile-&amp;gt;email = $Mycart-&amp;gt;Order-&amp;gt;Customer-&amp;gt;email;


	}

	function send ($data) {
		if ($this-&amp;gt;settings['testmode'] == "on") $url = $this-&amp;gt;testurl;
		else $url = $this-&amp;gt;liveurl;
		$url = apply_filters('mycart_authorize_net_url',$url);
		return $this-&amp;gt;response(parent::send($data,$url));
		
}

function response ($buffer) {
		$_ = new stdClass();

		list($_-&amp;gt;code,
			 $_-&amp;gt;subcode,
			 $_-&amp;gt;reasoncode,
			 $_-&amp;gt;reason,
			 $_-&amp;gt;authcode,
			 $_-&amp;gt;avs,
			 $_-&amp;gt;transactionid,
			 $_-&amp;gt;invoicenum,
			 $_-&amp;gt;description,
			 $_-&amp;gt;amount,
			 $_-&amp;gt;method,
			 $_-&amp;gt;type,
			 $_-&amp;gt;customerid,
			 $_-&amp;gt;firstname,
			 $_-&amp;gt;lastname,
			 $_-&amp;gt;company,
			 $_-&amp;gt;address,
			 $_-&amp;gt;city,
			 $_-&amp;gt;state,
			 $_-&amp;gt;zip,
			 $_-&amp;gt;country,
			 $_-&amp;gt;phone,
			 $_-&amp;gt;fax,
			 $_-&amp;gt;email,
			 $_-&amp;gt;ship_to_first_name,
			 $_-&amp;gt;ship_to_last_name,
			 $_-&amp;gt;ship_to_company,
			 $_-&amp;gt;ship_to_address,
			 $_-&amp;gt;ship_to_city,
			 $_-&amp;gt;ship_to_state,
			 $_-&amp;gt;ship_to_zip,
			 $_-&amp;gt;ship_to_country,
			 $_-&amp;gt;tax,
			 $_-&amp;gt;duty,
			 $_-&amp;gt;freight,
			 $_-&amp;gt;taxexempt,
			 $_-&amp;gt;ponum,
			 $_-&amp;gt;md5hash,
			 $_-&amp;gt;cvv2code,
			 $_-&amp;gt;cvv2response) = explode(",",$buffer);
		return $_;
	}


	function settings () {
		$this-&amp;gt;ui-&amp;gt;cardmenu(0,array(
			'name' =&amp;gt; 'cards',
			'selected' =&amp;gt; $this-&amp;gt;settings['cards']
		),$this-&amp;gt;cards);

		$this-&amp;gt;ui-&amp;gt;text(1,array(
			'name' =&amp;gt; 'login',
			'value' =&amp;gt; $this-&amp;gt;settings['login'],
			'size' =&amp;gt; '16',
			'label' =&amp;gt; __('Enter your AuthorizeNet Login ID.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;password(1,array(
			'name' =&amp;gt; 'password',
			'value' =&amp;gt; $this-&amp;gt;settings['password'],
			'size' =&amp;gt; '24',
			'label' =&amp;gt; __('Enter your AuthorizeNet Password or Transaction Key.','Mycart')
		));

		$this-&amp;gt;ui-&amp;gt;checkbox(1,array(
			'name' =&amp;gt; 'testmode',
			'checked' =&amp;gt; $this-&amp;gt;settings['testmode'],
			'label' =&amp;gt; __('Enable test mode','Mycart')
		));

	}

} // END class AuthorizeNet
?&amp;gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Mar 2013 16:14:04 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33334#M17854</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-05T16:14:04Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33353#M17873</link>
      <description>&lt;P&gt;In addition to the code above, I added the XML code&lt;/P&gt;&lt;PRE&gt;//build xml to post
$content =
	"&amp;lt;?xml version=\"1.0\" encoding=\"utf-8\"?&amp;gt;" .
	"&amp;lt;createCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\"&amp;gt;" .
	MerchantAuthenticationBlock().
	"&amp;lt;customerProfileId&amp;gt;12345&amp;lt;/customerProfileId&amp;gt;".  AND SO ON....&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;and I get this error;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Raw response: &amp;lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN""&lt;A target="_blank" href="http://www.w3.org/TR/html4/strict.dtd"&gt;http://www.w3.org/TR/html4/strict.dtd&lt;/A&gt;"&amp;gt; &amp;lt;HTML&amp;gt;&amp;lt;HEAD&amp;gt;&amp;lt;TITLE&amp;gt;Bad Request&amp;lt;/TITLE&amp;gt; &amp;lt;META HTTP-EQUIV="Content-Type" Content="text/html; charset=us-ascii"&amp;gt;&amp;lt;/HEAD&amp;gt; &amp;lt;BODY&amp;gt;&amp;lt;h2&amp;gt;Bad Request - Invalid URL&amp;lt;/h2&amp;gt; &amp;lt;hr&amp;gt;&amp;lt;p&amp;gt;HTTP Error 400. The request URL is invalid.&amp;lt;/p&amp;gt; &amp;lt;/BODY&amp;gt;&amp;lt;/HTML&amp;gt;&lt;BR /&gt;&lt;BR /&gt;The operation failed with the following errors:&amp;nbsp; (but no errors listed)&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 14:57:42 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33353#M17873</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-06T14:57:42Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33354#M17874</link>
      <description>&lt;P&gt;That a standard HTTP error message telling you that the URL is wrong.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 15:37:27 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33354#M17874</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-06T15:37:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33355#M17875</link>
      <description>&lt;P&gt;Thanks. Above that message is empty XML code.&lt;/P&gt;&lt;P&gt;Raw request: &amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;createCustomerPaymentProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;&amp;lt;merchantAuthentication&amp;gt;&amp;lt;name&amp;gt;&amp;lt;/name&amp;gt;&amp;lt;transactionKey&amp;gt;&amp;lt;/transactionKey&amp;gt;&amp;lt;/merchantAuthentication&amp;gt;&amp;lt;profile&amp;gt;&amp;lt;merchantCustomerId&amp;gt;&amp;lt;/merchantCustomerId&amp;gt;&amp;lt;description&amp;gt;none&amp;lt;/description&amp;gt;&amp;lt;email&amp;gt;&amp;lt;/email&amp;gt;&amp;lt;/profile&amp;gt;&amp;lt;/createCustomerProfileRequest&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any ideas. I know I have posted alot here just trying to get it to work.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 15:47:31 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33355#M17875</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-06T15:47:31Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33356#M17876</link>
      <description>&lt;P&gt;Is not the xml is the URL and how you are trying to pass the request xml.&lt;/P&gt;&lt;P&gt;You didn't just try to add the xml to the end of the url?&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 15:50:15 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33356#M17876</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-06T15:50:15Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33357#M17877</link>
      <description>&lt;P&gt;I know its messy. See above for all my code. I have been messing withthis for a week.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 15:56:50 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33357#M17877</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-06T15:56:50Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33358#M17878</link>
      <description>&lt;P&gt;I thought I could put the XML call inside the Build() function. But this might not be the correct way.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 16:21:27 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33358#M17878</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-06T16:21:27Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33359#M17879</link>
      <description>&lt;P&gt;why are you trying to do both CIM/AIM in your code? it would be simpler to start from fresh with the SDKs or sample code with just the CIM.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 16:25:39 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33359#M17879</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-06T16:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33360#M17880</link>
      <description>&lt;P&gt;Well I am trying to remove the AIM code and change to CIM. I can see how it sends the AIM info. But I can't understand how to send CIM. Becuase of the XML that needs to be sent.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 16:29:41 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33360#M17880</guid>
      <dc:creator>mallen</dc:creator>
      <dc:date>2013-03-06T16:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Convert from AIM to CIM</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33362#M17882</link>
      <description>&lt;P&gt;the PHP CIM sample code show how to send the xml either by fsockopen or curl&lt;/P&gt;&lt;P&gt;&lt;A target="_blank" href="http://developer.authorize.net/downloads/samplecode/"&gt;http://developer.authorize.net/downloads/samplecode/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Mar 2013 18:54:50 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/Convert-from-AIM-to-CIM/m-p/33362#M17882</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2013-03-06T18:54:50Z</dc:date>
    </item>
  </channel>
</rss>

