<?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 CIM Live getting E00027 here is one or more missing or invalid required fields in Integration and Testing</title>
    <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/CIM-Live-getting-E00027-here-is-one-or-more-missing-or-invalid/m-p/49029#M24651</link>
    <description>&lt;DIV class="window"&gt;&lt;DIV&gt;&lt;P&gt;When I try and create a new CIM using the test credit card number on a live account, I expect to get an invalid credit number response. &amp;nbsp;Instead, I am getting&amp;nbsp;&lt;SPAN&gt;E00027There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think somehow I am submitting as TEST instead of LIVE.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;AuthorizeNetCIM_Response&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[xml]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[messages]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[resultCode]&amp;nbsp;=&amp;gt;&amp;nbsp;Error&amp;nbsp;[message]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[code]&amp;nbsp;=&amp;gt;&amp;nbsp;E00027&amp;nbsp;[text]&amp;nbsp;=&amp;gt;&amp;nbsp;There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[customerPaymentProfileIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[customerShippingAddressIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[validationDirectResponseList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[string]&amp;nbsp;=&amp;gt;&amp;nbsp;3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[response]&amp;nbsp;=&amp;gt;&amp;nbsp;?ErrorE00027There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;[xpath_xml]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[messages]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[resultCode]&amp;nbsp;=&amp;gt;&amp;nbsp;Error&amp;nbsp;[message]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[code]&amp;nbsp;=&amp;gt;&amp;nbsp;E00027&amp;nbsp;[text]&amp;nbsp;=&amp;gt;&amp;nbsp;There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[customerPaymentProfileIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[customerShippingAddressIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[validationDirectResponseList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[string]&amp;nbsp;=&amp;gt;&amp;nbsp;3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;)&amp;nbsp;)&amp;nbsp;)&amp;nbsp;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the SDK, I updated the class to see what happens when I make Sandbox URL the live url as I was getting an error. &amp;nbsp;I also updated the class to make sure it defaults to live mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
/**
 * Easily interact with the Authorize.Net CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 * @link       &lt;A target="_blank" href="http://www.authorize.net/support/CIM_XML_guide.pdf"&gt;http://www.authorize.net/support/CIM_XML_guide.pdf&lt;/A&gt; CIM XML Guide
 */



/**
 * A class to send a request to the CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 */ 
class AuthorizeNetCIM extends AuthorizeNetRequest
{

    const LIVE_URL = "&lt;A target="_blank" href="https://api.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://api.authorize.net/xml/v1/request.api";&lt;/A&gt;
   // const SANDBOX_URL = "&lt;A target="_blank" href="https://apitest.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://apitest.authorize.net/xml/v1/request.api";&lt;/A&gt;
   const SANDBOX_URL = "&lt;A target="_blank" href="https://api.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://api.authorize.net/xml/v1/request.api";&lt;/A&gt;
    
    private $_xml;
    private $_refId = false;
    private $_validationMode = "liveMode"; // "none","testMode","liveMode"
    private $_extraOptions;
    private $_transactionTypes = array(
        'AuthOnly',
        'AuthCapture',
        'CaptureOnly',
        'PriorAuthCapture',
        'Refund',
        'Void',
    );
    
    /**
     * Optional. Used if the merchant wants to set a reference ID.
     *
     * @param string $refId
     */
    public function setRefId($refId)
    {
        $this-&amp;gt;_refId = $refId;
    }
    
    /**
     * Create a customer profile.
     *
     * @param AuthorizeNetCustomer $customerProfile
     * @param string               $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerProfile($customerProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("createCustomerProfileRequest");
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("profile");
        $this-&amp;gt;_addObject($profile, $customerProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a customer payment profile.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetPaymentProfile $paymentProfile
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerPaymentProfile($customerProfileId, $paymentProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("createCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("paymentProfile");
        $this-&amp;gt;_addObject($profile, $paymentProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a shipping address.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetAddress        $shippingAddress
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerShippingAddress($customerProfileId, $shippingAddress)
    {
        $this-&amp;gt;_constructXml("createCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $address = $this-&amp;gt;_xml-&amp;gt;addChild("address");
        $this-&amp;gt;_addObject($address, $shippingAddress);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a transaction.
     *
     * @param string                     $transactionType
     * @param AuthorizeNetTransaction    $transaction
     * @param string                     $extraOptionsString
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerProfileTransaction($transactionType, $transaction, $extraOptionsString = "")
    {
        $this-&amp;gt;_constructXml("createCustomerProfileTransactionRequest");
        $transactionParent = $this-&amp;gt;_xml-&amp;gt;addChild("transaction");
        $transactionChild = $transactionParent-&amp;gt;addChild("profileTrans" . $transactionType);
        $this-&amp;gt;_addObject($transactionChild, $transaction);
        $this-&amp;gt;_extraOptions = $extraOptionsString . "x_encap_char=|";
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a customer profile.
     *
     * @param int $customerProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerProfile($customerProfileId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a payment profile.
     *
     * @param int $customerProfileId
     * @param int $customerPaymentProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId", $customerPaymentProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a shipping address.
     *
     * @param int $customerProfileId
     * @param int $customerAddressId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerShippingAddress($customerProfileId, $customerAddressId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerAddressId", $customerAddressId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get all customer profile ids.
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerProfileIds()
    {
        $this-&amp;gt;_constructXml("getCustomerProfileIdsRequest");
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a customer profile.
     *
     * @param int $customerProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerProfile($customerProfileId)
    {
        $this-&amp;gt;_constructXml("getCustomerProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a payment profile.
     *
     * @param int $customerProfileId
     * @param int $customerPaymentProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId)
    {
        $this-&amp;gt;_constructXml("getCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId", $customerPaymentProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a shipping address.
     *
     * @param int $customerProfileId
     * @param int $customerAddressId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerShippingAddress($customerProfileId, $customerAddressId)
    {
        $this-&amp;gt;_constructXml("getCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerAddressId", $customerAddressId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a profile.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetCustomer       $customerProfile
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerProfile($customerProfileId, $customerProfile)
    {
        $this-&amp;gt;_constructXml("updateCustomerProfileRequest");
        $customerProfile-&amp;gt;customerProfileId = $customerProfileId;
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("profile");
        $this-&amp;gt;_addObject($profile, $customerProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a payment profile.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerPaymentProfileId
     * @param AuthorizeNetPaymentProfile $paymentProfile
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $paymentProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("updateCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $paymentProfile-&amp;gt;customerPaymentProfileId = $customerPaymentProfileId;
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("paymentProfile");
        $this-&amp;gt;_addObject($profile, $paymentProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a shipping address.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerShippingAddressId
     * @param AuthorizeNetAddress        $shippingAddress
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerShippingAddress($customerProfileId, $customerShippingAddressId, $shippingAddress)
    {
        
        $this-&amp;gt;_constructXml("updateCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $shippingAddress-&amp;gt;customerAddressId = $customerShippingAddressId;
        $sa = $this-&amp;gt;_xml-&amp;gt;addChild("address");
        $this-&amp;gt;_addObject($sa, $shippingAddress);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update the status of an existing order that contains multiple transactions with the same splitTenderId.
     *
     * @param int                        $splitTenderId
     * @param string                     $splitTenderStatus
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateSplitTenderGroup($splitTenderId, $splitTenderStatus)
    {
        $this-&amp;gt;_constructXml("updateSplitTenderGroupRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("splitTenderId", $splitTenderId);
        $this-&amp;gt;_xml-&amp;gt;addChild("splitTenderStatus", $splitTenderStatus);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Validate a customer payment profile.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerPaymentProfileId
     * @param int                        $customerShippingAddressId
     * @param int                        $cardCode
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function validateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $customerShippingAddressId, $cardCode, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("validateCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId",$customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId",$customerPaymentProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerShippingAddressId",$customerShippingAddressId);
        $this-&amp;gt;_xml-&amp;gt;addChild("cardCode",$cardCode);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get hosted profile page request token
     *
     * @param string $customerProfileId
     * @param mixed  $settings
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getHostedProfilePageRequest($customerProfileId, $settings=0)
    {
        $this-&amp;gt;_constructXml("getHostedProfilePageRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);

        if (!empty($settings)) {
            $hostedSettings = $this-&amp;gt;_xml-&amp;gt;addChild("hostedProfileSettings");
            foreach ($settings as $key =&amp;gt; $val) {
                $setting = $hostedSettings-&amp;gt;addChild("setting");
                $setting-&amp;gt;addChild("settingName", $key);
                $setting-&amp;gt;addChild("settingValue", $val);
            }
        }

        return $this-&amp;gt;_sendRequest();
    }
    
     /**
     * @return string
     */
    protected function _getPostUrl()
    {
        return ($this-&amp;gt;_sandbox ? self::SANDBOX_URL : self::LIVE_URL);
    }
    
    /**
     *
     *
     * @param string $response
     * 
     * @return AuthorizeNetCIM_Response
     */
    protected function _handleResponse($response)
    {
        return new AuthorizeNetCIM_Response($response);
    }
    
    /**
     * Prepare the XML post string.
     */
    protected function _setPostString()
    {
        ($this-&amp;gt;_validationMode != "none" ? $this-&amp;gt;_xml-&amp;gt;addChild('validationMode',$this-&amp;gt;_validationMode) : "");
        $this-&amp;gt;_post_string = $this-&amp;gt;_xml-&amp;gt;asXML();
        
        // Add extraOptions CDATA
        if ($this-&amp;gt;_extraOptions) {
            $this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");
            $this-&amp;gt;_post_string = str_replace(array("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;","&amp;lt;extraOptions/&amp;gt;"),'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());
            $this-&amp;gt;_extraOptions = false;
        }
        // Blank out our validation mode, so that we don't include it in calls that
        // don't use it.
        $this-&amp;gt;_validationMode = "none";
    }
    
    /**
     * Start the SimpleXMLElement that will be posted.
     *
     * @param string $request_type The action to be performed.
     */
    private function _constructXml($request_type)
    {
        $string = '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;&amp;lt;/'.$request_type.'&amp;gt;';
        $this-&amp;gt;_xml = @new SimpleXMLElement($string);
        $merchant = $this-&amp;gt;_xml-&amp;gt;addChild('merchantAuthentication');
        $merchant-&amp;gt;addChild('name',$this-&amp;gt;_api_login);
        $merchant-&amp;gt;addChild('transactionKey',$this-&amp;gt;_transaction_key);
        ($this-&amp;gt;_refId ? $this-&amp;gt;_xml-&amp;gt;addChild('refId',$this-&amp;gt;_refId) : "");
    }
    
    /**
     * Add an object to an SimpleXMLElement parent element.
     *
     * @param SimpleXMLElement $destination The parent element.
     * @param Object           $object      An object, array or value.  
     */
    private function _addObject($destination, $object)
    {
        $array = (array)$object;
        foreach ($array as $key =&amp;gt; $value) {
            if ($value &amp;amp;&amp;amp; !is_object($value)) {
                if (is_array($value) &amp;amp;&amp;amp; count($value)) {
                    foreach ($value as $index =&amp;gt; $item) {
                        $items = $destination-&amp;gt;addChild($key);
                        $this-&amp;gt;_addObject($items, $item);
                    }
                } else {
                    $destination-&amp;gt;addChild($key,$value);
                }
            } elseif (is_object($value) &amp;amp;&amp;amp; self::_notEmpty($value)) {
                $dest = $destination-&amp;gt;addChild($key);
                $this-&amp;gt;_addObject($dest, $value);
            }
        }
    }
    
    /**
     * Checks whether an array or object contains any values.
     *
     * @param Object $object
     *
     * @return bool
     */
    private static function _notEmpty($object)
    {
        $array = (array)$object;
        foreach ($array as $key =&amp;gt; $value) {
            if ($value &amp;amp;&amp;amp; !is_object($value)) {
                return true;
            } elseif (is_object($value)) {
                if (self::_notEmpty($value)) {
                    return true;
                }
            }
        }
        return false;
    }
    
}

/**
 * A class to parse a response from the CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 */
class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
{
    /**
     * @return AuthorizeNetAIM_Response
     */
    public function getTransactionResponse()
    {
        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "|", array());
    }
    
    /**
     * @return array Array of AuthorizeNetAIM_Response objects for each payment profile.
     */
    public function getValidationResponses()
    {
        $responses = (array)$this-&amp;gt;xml-&amp;gt;validationDirectResponseList;
        $return = array();
        foreach ((array)$responses["string"] as $response) {
            $return[] = new AuthorizeNetAIM_Response($response, ",", "", array());
        }
        return $return;
    }
    
    /**
     * @return AuthorizeNetAIM_Response
     */
    public function getValidationResponse()
    {
        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "|", array());
    }
    
    /**
     * @return array
     */
    public function getCustomerProfileIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;ids;
        return $ids["numericString"];
    }
    
    /**
     * @return array
     */
    public function getCustomerPaymentProfileIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;customerPaymentProfileIdList;
        return $ids["numericString"];
    }
    
    /**
     * @return array
     */
    public function getCustomerShippingAddressIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;customerShippingAddressIdList;
        return $ids["numericString"];
    }
    
    /**
     * @return string
     */
    public function getCustomerAddressId()
    {
        return $this-&amp;gt;_getElementContents("customerAddressId");
    }
    
    /**
     * @return string
     */
    public function getCustomerProfileId()
    {
        return $this-&amp;gt;_getElementContents("customerProfileId");
    }
    
    /**
     * @return string
     */
    public function getPaymentProfileId()
    {
        return $this-&amp;gt;_getElementContents("customerPaymentProfileId");
    }

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This is the code that is creating the CIM profile&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if(isset($_POST)){
	
	if($_POST["sitepass"]=sitepass and $_POST["action"]="newCIM"){
		
		// first check to see if a previous profile exists.  If it does, then delete it and update the database. 
		
			if(isset($_POST["currentCIM"])){
				
				if (strlen($_POST["currentCIM"]) &amp;gt; 5){
				
					$old_CIM = $_POST["currentCIM"];
					$request = new AuthorizeNetCIM;
					$request-&amp;gt;deleteCustomerProfile($old_CIM);
					
					UpdateContactCIM( $_POST["contactid"],"0","0","0" ,$db);
				
				}
			}
		
			
			if(isset($_POST["removeProfile"])){
				
				if ($_POST["removeProfile"]="1"){
					$old_CIM = $_POST["currentCIM"];
					$request = new AuthorizeNetCIM;
					$request-&amp;gt;deleteCustomerProfile($old_CIM);
					
					UpdateContactCIM( $_POST["contactid"],"0","0","0" ,$db);
					die("1|Profile Removed");
					
					}
				}
			
		
					$contact_id			 	= $_POST["contactid"];
					$contact_first			= $_POST["firstname"];
					$contact_last			= $_POST["lastname"];
					$contact_address	= $_POST["address"];
					$contact_city			= $_POST["city"];
					$contact_st				= $_POST["st"];
					$contact_zip				= $_POST["zip"];
					$contact_email			=	$_POST["email"];
					$contact_phone		=	$_POST["phone"];
					$contact_card			=	$_POST["creditcard"];
					$contact_card_yr		=	$_POST["year"];
					$contact_card_mo	=	$_POST["month"];
					
					$contact_name		= $contact_first." ".$contact_last;
					$exp_date				= $contact_card_yr."-".$contact_card_mo;
			
					$request = new AuthorizeNetCIM;
					// Create new customer profile
					
					$customerProfile                     = new AuthorizeNetCustomer;
					
					$customerProfile-&amp;gt;description        			= $contact_name;
					$customerProfile-&amp;gt;merchantCustomerId 	= $contact_id;
					$customerProfile-&amp;gt;email              			= $contact_email;
					
					// Add payment profile.
					$paymentProfile = new AuthorizeNetPaymentProfile;
					$paymentProfile-&amp;gt;customerType = "individual";
					$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;cardNumber = $contact_card;
					$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;expirationDate = $exp_date;
					$customerProfile-&amp;gt;paymentProfiles[] = $paymentProfile;
					
					$response = $request-&amp;gt;createCustomerProfile($customerProfile);
					
					die(print_r($response));
					
					
					$validationResponses = $response-&amp;gt;getValidationResponses();
 						 foreach ($validationResponses as $vr) {
    							echo $vr-&amp;gt;approved;
							}
					
					
					//profile/paymentProfiles/customerPaymentProfileId
					$arrProfile =  $response-&amp;gt;xpath('customerPaymentProfileIdList/numericString');
					if ($arrProfile){
						$paymentProfileId = $arrProfile[0];  // get the payment id
					
					}
					else
					{
						$paymentProfileId = 0;
					}
					
					
					if ($response-&amp;gt;isOk()) {
							$customerProfileId = $response-&amp;gt;getCustomerProfileId();
							
							$address = new AuthorizeNetAddress;
							$address-&amp;gt;firstName 			= $contact_first;
							$address-&amp;gt;lastName 			= $contact_last;
							//$address-&amp;gt;company			= "John Doe Company";
							$address-&amp;gt;address 			= $contact_address;
							$address-&amp;gt;city 					= $contact_city;
							$address-&amp;gt;state 				= $contact_st;
							$address-&amp;gt;zip 					= 	$contact_zip;
							//$address-&amp;gt;country	 		= "USA";
							$address-&amp;gt;phoneNumber 	= $contact_phone;
							//$address-&amp;gt;faxNumber 		= "555-555-5556";
							$response = $request-&amp;gt;createCustomerShippingAddress($customerProfileId, $address);
							$customerAddressId = $response-&amp;gt;getCustomerAddressId();
							//$customerPaymentID = $response-&amp;gt;getCustomerPaymentProfileIds();
							
							// Update database with profile id
							
					
							
							UpdateContactCIM($contact_id,$customerProfileId,$customerAddressId,$paymentProfileId ,$db);
							// Create Payment 
						
							
							echo "1|".$customerProfileId."-".$customerAddressId." - ".$paymentProfileId. "- ";
					}
					else
					{
							echo "0|".$response-&amp;gt;xml-&amp;gt;messages-&amp;gt;message-&amp;gt;text;
					}
	}
	else
	{
		echo "0|Internal Error-create profile";	
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In my config file I have the log in an pass set to the live credentials.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;define("AUTHORIZENET_API_LOGIN_ID", $login_id);
define("AUTHORIZENET_TRANSACTION_KEY", $trans_key);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 02 Dec 2014 23:24:24 GMT</pubDate>
    <dc:creator>skirider</dc:creator>
    <dc:date>2014-12-02T23:24:24Z</dc:date>
    <item>
      <title>CIM Live getting E00027 here is one or more missing or invalid required fields</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/CIM-Live-getting-E00027-here-is-one-or-more-missing-or-invalid/m-p/49029#M24651</link>
      <description>&lt;DIV class="window"&gt;&lt;DIV&gt;&lt;P&gt;When I try and create a new CIM using the test credit card number on a live account, I expect to get an invalid credit number response. &amp;nbsp;Instead, I am getting&amp;nbsp;&lt;SPAN&gt;E00027There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I think somehow I am submitting as TEST instead of LIVE.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;TABLE cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;&lt;SPAN&gt;AuthorizeNetCIM_Response&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[xml]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[messages]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[resultCode]&amp;nbsp;=&amp;gt;&amp;nbsp;Error&amp;nbsp;[message]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[code]&amp;nbsp;=&amp;gt;&amp;nbsp;E00027&amp;nbsp;[text]&amp;nbsp;=&amp;gt;&amp;nbsp;There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[customerPaymentProfileIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[customerShippingAddressIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[validationDirectResponseList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[string]&amp;nbsp;=&amp;gt;&amp;nbsp;3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[response]&amp;nbsp;=&amp;gt;&amp;nbsp;?ErrorE00027There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;[xpath_xml]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[messages]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[resultCode]&amp;nbsp;=&amp;gt;&amp;nbsp;Error&amp;nbsp;[message]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[code]&amp;nbsp;=&amp;gt;&amp;nbsp;E00027&amp;nbsp;[text]&amp;nbsp;=&amp;gt;&amp;nbsp;There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.&amp;nbsp;)&amp;nbsp;)&amp;nbsp;[customerPaymentProfileIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[customerShippingAddressIdList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;)&amp;nbsp;[validationDirectResponseList]&amp;nbsp;=&amp;gt;&amp;nbsp;SimpleXMLElement&amp;nbsp;Object&amp;nbsp;(&amp;nbsp;[string]&amp;nbsp;=&amp;gt;&amp;nbsp;3,1,290,There&amp;nbsp;is&amp;nbsp;one&amp;nbsp;or&amp;nbsp;more&amp;nbsp;missing&amp;nbsp;or&amp;nbsp;invalid&amp;nbsp;required&amp;nbsp;fields.,,P,0,none,Test&amp;nbsp;transaction&amp;nbsp;for&amp;nbsp;ValidateCustomerPaymentProfile.,0.00,CC,auth_only,51797,,,,,,,,,,,me@mydomain,,,,,,,,,0.00,0.00,0.00,FALSE,none,F68A9C87C1E1472521704EF38C21F647,,,,,,,,,,,,,XXXX1111,Visa,,,,,,,,,,,,,,,,&amp;nbsp;)&amp;nbsp;)&amp;nbsp;)&amp;nbsp;1&lt;/SPAN&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using the SDK, I updated the class to see what happens when I make Sandbox URL the live url as I was getting an error. &amp;nbsp;I also updated the class to make sure it defaults to live mode.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&amp;lt;?php
/**
 * Easily interact with the Authorize.Net CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 * @link       &lt;A target="_blank" href="http://www.authorize.net/support/CIM_XML_guide.pdf"&gt;http://www.authorize.net/support/CIM_XML_guide.pdf&lt;/A&gt; CIM XML Guide
 */



/**
 * A class to send a request to the CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 */ 
class AuthorizeNetCIM extends AuthorizeNetRequest
{

    const LIVE_URL = "&lt;A target="_blank" href="https://api.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://api.authorize.net/xml/v1/request.api";&lt;/A&gt;
   // const SANDBOX_URL = "&lt;A target="_blank" href="https://apitest.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://apitest.authorize.net/xml/v1/request.api";&lt;/A&gt;
   const SANDBOX_URL = "&lt;A target="_blank" href="https://api.authorize.net/xml/v1/request.api&amp;quot;;"&gt;https://api.authorize.net/xml/v1/request.api";&lt;/A&gt;
    
    private $_xml;
    private $_refId = false;
    private $_validationMode = "liveMode"; // "none","testMode","liveMode"
    private $_extraOptions;
    private $_transactionTypes = array(
        'AuthOnly',
        'AuthCapture',
        'CaptureOnly',
        'PriorAuthCapture',
        'Refund',
        'Void',
    );
    
    /**
     * Optional. Used if the merchant wants to set a reference ID.
     *
     * @param string $refId
     */
    public function setRefId($refId)
    {
        $this-&amp;gt;_refId = $refId;
    }
    
    /**
     * Create a customer profile.
     *
     * @param AuthorizeNetCustomer $customerProfile
     * @param string               $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerProfile($customerProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("createCustomerProfileRequest");
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("profile");
        $this-&amp;gt;_addObject($profile, $customerProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a customer payment profile.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetPaymentProfile $paymentProfile
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerPaymentProfile($customerProfileId, $paymentProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("createCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("paymentProfile");
        $this-&amp;gt;_addObject($profile, $paymentProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a shipping address.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetAddress        $shippingAddress
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerShippingAddress($customerProfileId, $shippingAddress)
    {
        $this-&amp;gt;_constructXml("createCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $address = $this-&amp;gt;_xml-&amp;gt;addChild("address");
        $this-&amp;gt;_addObject($address, $shippingAddress);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Create a transaction.
     *
     * @param string                     $transactionType
     * @param AuthorizeNetTransaction    $transaction
     * @param string                     $extraOptionsString
     *
     * @return AuthorizeNetCIM_Response
     */
    public function createCustomerProfileTransaction($transactionType, $transaction, $extraOptionsString = "")
    {
        $this-&amp;gt;_constructXml("createCustomerProfileTransactionRequest");
        $transactionParent = $this-&amp;gt;_xml-&amp;gt;addChild("transaction");
        $transactionChild = $transactionParent-&amp;gt;addChild("profileTrans" . $transactionType);
        $this-&amp;gt;_addObject($transactionChild, $transaction);
        $this-&amp;gt;_extraOptions = $extraOptionsString . "x_encap_char=|";
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a customer profile.
     *
     * @param int $customerProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerProfile($customerProfileId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a payment profile.
     *
     * @param int $customerProfileId
     * @param int $customerPaymentProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId", $customerPaymentProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Delete a shipping address.
     *
     * @param int $customerProfileId
     * @param int $customerAddressId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function deleteCustomerShippingAddress($customerProfileId, $customerAddressId)
    {
        $this-&amp;gt;_constructXml("deleteCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerAddressId", $customerAddressId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get all customer profile ids.
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerProfileIds()
    {
        $this-&amp;gt;_constructXml("getCustomerProfileIdsRequest");
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a customer profile.
     *
     * @param int $customerProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerProfile($customerProfileId)
    {
        $this-&amp;gt;_constructXml("getCustomerProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a payment profile.
     *
     * @param int $customerProfileId
     * @param int $customerPaymentProfileId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId)
    {
        $this-&amp;gt;_constructXml("getCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId", $customerPaymentProfileId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get a shipping address.
     *
     * @param int $customerProfileId
     * @param int $customerAddressId
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getCustomerShippingAddress($customerProfileId, $customerAddressId)
    {
        $this-&amp;gt;_constructXml("getCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerAddressId", $customerAddressId);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a profile.
     *
     * @param int                        $customerProfileId
     * @param AuthorizeNetCustomer       $customerProfile
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerProfile($customerProfileId, $customerProfile)
    {
        $this-&amp;gt;_constructXml("updateCustomerProfileRequest");
        $customerProfile-&amp;gt;customerProfileId = $customerProfileId;
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("profile");
        $this-&amp;gt;_addObject($profile, $customerProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a payment profile.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerPaymentProfileId
     * @param AuthorizeNetPaymentProfile $paymentProfile
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $paymentProfile, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("updateCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $paymentProfile-&amp;gt;customerPaymentProfileId = $customerPaymentProfileId;
        $profile = $this-&amp;gt;_xml-&amp;gt;addChild("paymentProfile");
        $this-&amp;gt;_addObject($profile, $paymentProfile);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update a shipping address.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerShippingAddressId
     * @param AuthorizeNetAddress        $shippingAddress
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateCustomerShippingAddress($customerProfileId, $customerShippingAddressId, $shippingAddress)
    {
        
        $this-&amp;gt;_constructXml("updateCustomerShippingAddressRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);
        $shippingAddress-&amp;gt;customerAddressId = $customerShippingAddressId;
        $sa = $this-&amp;gt;_xml-&amp;gt;addChild("address");
        $this-&amp;gt;_addObject($sa, $shippingAddress);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Update the status of an existing order that contains multiple transactions with the same splitTenderId.
     *
     * @param int                        $splitTenderId
     * @param string                     $splitTenderStatus
     *
     * @return AuthorizeNetCIM_Response
     */
    public function updateSplitTenderGroup($splitTenderId, $splitTenderStatus)
    {
        $this-&amp;gt;_constructXml("updateSplitTenderGroupRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("splitTenderId", $splitTenderId);
        $this-&amp;gt;_xml-&amp;gt;addChild("splitTenderStatus", $splitTenderStatus);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Validate a customer payment profile.
     *
     * @param int                        $customerProfileId
     * @param int                        $customerPaymentProfileId
     * @param int                        $customerShippingAddressId
     * @param int                        $cardCode
     * @param string                     $validationMode
     *
     * @return AuthorizeNetCIM_Response
     */
    public function validateCustomerPaymentProfile($customerProfileId, $customerPaymentProfileId, $customerShippingAddressId, $cardCode, $validationMode = "liveMode")
    {
        $this-&amp;gt;_validationMode = $validationMode;
        $this-&amp;gt;_constructXml("validateCustomerPaymentProfileRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId",$customerProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerPaymentProfileId",$customerPaymentProfileId);
        $this-&amp;gt;_xml-&amp;gt;addChild("customerShippingAddressId",$customerShippingAddressId);
        $this-&amp;gt;_xml-&amp;gt;addChild("cardCode",$cardCode);
        return $this-&amp;gt;_sendRequest();
    }
    
    /**
     * Get hosted profile page request token
     *
     * @param string $customerProfileId
     * @param mixed  $settings
     *
     * @return AuthorizeNetCIM_Response
     */
    public function getHostedProfilePageRequest($customerProfileId, $settings=0)
    {
        $this-&amp;gt;_constructXml("getHostedProfilePageRequest");
        $this-&amp;gt;_xml-&amp;gt;addChild("customerProfileId", $customerProfileId);

        if (!empty($settings)) {
            $hostedSettings = $this-&amp;gt;_xml-&amp;gt;addChild("hostedProfileSettings");
            foreach ($settings as $key =&amp;gt; $val) {
                $setting = $hostedSettings-&amp;gt;addChild("setting");
                $setting-&amp;gt;addChild("settingName", $key);
                $setting-&amp;gt;addChild("settingValue", $val);
            }
        }

        return $this-&amp;gt;_sendRequest();
    }
    
     /**
     * @return string
     */
    protected function _getPostUrl()
    {
        return ($this-&amp;gt;_sandbox ? self::SANDBOX_URL : self::LIVE_URL);
    }
    
    /**
     *
     *
     * @param string $response
     * 
     * @return AuthorizeNetCIM_Response
     */
    protected function _handleResponse($response)
    {
        return new AuthorizeNetCIM_Response($response);
    }
    
    /**
     * Prepare the XML post string.
     */
    protected function _setPostString()
    {
        ($this-&amp;gt;_validationMode != "none" ? $this-&amp;gt;_xml-&amp;gt;addChild('validationMode',$this-&amp;gt;_validationMode) : "");
        $this-&amp;gt;_post_string = $this-&amp;gt;_xml-&amp;gt;asXML();
        
        // Add extraOptions CDATA
        if ($this-&amp;gt;_extraOptions) {
            $this-&amp;gt;_xml-&amp;gt;addChild("extraOptions");
            $this-&amp;gt;_post_string = str_replace(array("&amp;lt;extraOptions&amp;gt;&amp;lt;/extraOptions&amp;gt;","&amp;lt;extraOptions/&amp;gt;"),'&amp;lt;extraOptions&amp;gt;&amp;lt;![CDATA[' . $this-&amp;gt;_extraOptions . ']]&amp;gt;&amp;lt;/extraOptions&amp;gt;', $this-&amp;gt;_xml-&amp;gt;asXML());
            $this-&amp;gt;_extraOptions = false;
        }
        // Blank out our validation mode, so that we don't include it in calls that
        // don't use it.
        $this-&amp;gt;_validationMode = "none";
    }
    
    /**
     * Start the SimpleXMLElement that will be posted.
     *
     * @param string $request_type The action to be performed.
     */
    private function _constructXml($request_type)
    {
        $string = '&amp;lt;?xml version="1.0" encoding="utf-8"?&amp;gt;&amp;lt;'.$request_type.' xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"&amp;gt;&amp;lt;/'.$request_type.'&amp;gt;';
        $this-&amp;gt;_xml = @new SimpleXMLElement($string);
        $merchant = $this-&amp;gt;_xml-&amp;gt;addChild('merchantAuthentication');
        $merchant-&amp;gt;addChild('name',$this-&amp;gt;_api_login);
        $merchant-&amp;gt;addChild('transactionKey',$this-&amp;gt;_transaction_key);
        ($this-&amp;gt;_refId ? $this-&amp;gt;_xml-&amp;gt;addChild('refId',$this-&amp;gt;_refId) : "");
    }
    
    /**
     * Add an object to an SimpleXMLElement parent element.
     *
     * @param SimpleXMLElement $destination The parent element.
     * @param Object           $object      An object, array or value.  
     */
    private function _addObject($destination, $object)
    {
        $array = (array)$object;
        foreach ($array as $key =&amp;gt; $value) {
            if ($value &amp;amp;&amp;amp; !is_object($value)) {
                if (is_array($value) &amp;amp;&amp;amp; count($value)) {
                    foreach ($value as $index =&amp;gt; $item) {
                        $items = $destination-&amp;gt;addChild($key);
                        $this-&amp;gt;_addObject($items, $item);
                    }
                } else {
                    $destination-&amp;gt;addChild($key,$value);
                }
            } elseif (is_object($value) &amp;amp;&amp;amp; self::_notEmpty($value)) {
                $dest = $destination-&amp;gt;addChild($key);
                $this-&amp;gt;_addObject($dest, $value);
            }
        }
    }
    
    /**
     * Checks whether an array or object contains any values.
     *
     * @param Object $object
     *
     * @return bool
     */
    private static function _notEmpty($object)
    {
        $array = (array)$object;
        foreach ($array as $key =&amp;gt; $value) {
            if ($value &amp;amp;&amp;amp; !is_object($value)) {
                return true;
            } elseif (is_object($value)) {
                if (self::_notEmpty($value)) {
                    return true;
                }
            }
        }
        return false;
    }
    
}

/**
 * A class to parse a response from the CIM XML API.
 *
 * @package    AuthorizeNet
 * @subpackage AuthorizeNetCIM
 */
class AuthorizeNetCIM_Response extends AuthorizeNetXMLResponse
{
    /**
     * @return AuthorizeNetAIM_Response
     */
    public function getTransactionResponse()
    {
        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("directResponse"), ",", "|", array());
    }
    
    /**
     * @return array Array of AuthorizeNetAIM_Response objects for each payment profile.
     */
    public function getValidationResponses()
    {
        $responses = (array)$this-&amp;gt;xml-&amp;gt;validationDirectResponseList;
        $return = array();
        foreach ((array)$responses["string"] as $response) {
            $return[] = new AuthorizeNetAIM_Response($response, ",", "", array());
        }
        return $return;
    }
    
    /**
     * @return AuthorizeNetAIM_Response
     */
    public function getValidationResponse()
    {
        return new AuthorizeNetAIM_Response($this-&amp;gt;_getElementContents("validationDirectResponse"), ",", "|", array());
    }
    
    /**
     * @return array
     */
    public function getCustomerProfileIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;ids;
        return $ids["numericString"];
    }
    
    /**
     * @return array
     */
    public function getCustomerPaymentProfileIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;customerPaymentProfileIdList;
        return $ids["numericString"];
    }
    
    /**
     * @return array
     */
    public function getCustomerShippingAddressIds()
    {
        $ids = (array)$this-&amp;gt;xml-&amp;gt;customerShippingAddressIdList;
        return $ids["numericString"];
    }
    
    /**
     * @return string
     */
    public function getCustomerAddressId()
    {
        return $this-&amp;gt;_getElementContents("customerAddressId");
    }
    
    /**
     * @return string
     */
    public function getCustomerProfileId()
    {
        return $this-&amp;gt;_getElementContents("customerProfileId");
    }
    
    /**
     * @return string
     */
    public function getPaymentProfileId()
    {
        return $this-&amp;gt;_getElementContents("customerPaymentProfileId");
    }

}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;This is the code that is creating the CIM profile&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;if(isset($_POST)){
	
	if($_POST["sitepass"]=sitepass and $_POST["action"]="newCIM"){
		
		// first check to see if a previous profile exists.  If it does, then delete it and update the database. 
		
			if(isset($_POST["currentCIM"])){
				
				if (strlen($_POST["currentCIM"]) &amp;gt; 5){
				
					$old_CIM = $_POST["currentCIM"];
					$request = new AuthorizeNetCIM;
					$request-&amp;gt;deleteCustomerProfile($old_CIM);
					
					UpdateContactCIM( $_POST["contactid"],"0","0","0" ,$db);
				
				}
			}
		
			
			if(isset($_POST["removeProfile"])){
				
				if ($_POST["removeProfile"]="1"){
					$old_CIM = $_POST["currentCIM"];
					$request = new AuthorizeNetCIM;
					$request-&amp;gt;deleteCustomerProfile($old_CIM);
					
					UpdateContactCIM( $_POST["contactid"],"0","0","0" ,$db);
					die("1|Profile Removed");
					
					}
				}
			
		
					$contact_id			 	= $_POST["contactid"];
					$contact_first			= $_POST["firstname"];
					$contact_last			= $_POST["lastname"];
					$contact_address	= $_POST["address"];
					$contact_city			= $_POST["city"];
					$contact_st				= $_POST["st"];
					$contact_zip				= $_POST["zip"];
					$contact_email			=	$_POST["email"];
					$contact_phone		=	$_POST["phone"];
					$contact_card			=	$_POST["creditcard"];
					$contact_card_yr		=	$_POST["year"];
					$contact_card_mo	=	$_POST["month"];
					
					$contact_name		= $contact_first." ".$contact_last;
					$exp_date				= $contact_card_yr."-".$contact_card_mo;
			
					$request = new AuthorizeNetCIM;
					// Create new customer profile
					
					$customerProfile                     = new AuthorizeNetCustomer;
					
					$customerProfile-&amp;gt;description        			= $contact_name;
					$customerProfile-&amp;gt;merchantCustomerId 	= $contact_id;
					$customerProfile-&amp;gt;email              			= $contact_email;
					
					// Add payment profile.
					$paymentProfile = new AuthorizeNetPaymentProfile;
					$paymentProfile-&amp;gt;customerType = "individual";
					$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;cardNumber = $contact_card;
					$paymentProfile-&amp;gt;payment-&amp;gt;creditCard-&amp;gt;expirationDate = $exp_date;
					$customerProfile-&amp;gt;paymentProfiles[] = $paymentProfile;
					
					$response = $request-&amp;gt;createCustomerProfile($customerProfile);
					
					die(print_r($response));
					
					
					$validationResponses = $response-&amp;gt;getValidationResponses();
 						 foreach ($validationResponses as $vr) {
    							echo $vr-&amp;gt;approved;
							}
					
					
					//profile/paymentProfiles/customerPaymentProfileId
					$arrProfile =  $response-&amp;gt;xpath('customerPaymentProfileIdList/numericString');
					if ($arrProfile){
						$paymentProfileId = $arrProfile[0];  // get the payment id
					
					}
					else
					{
						$paymentProfileId = 0;
					}
					
					
					if ($response-&amp;gt;isOk()) {
							$customerProfileId = $response-&amp;gt;getCustomerProfileId();
							
							$address = new AuthorizeNetAddress;
							$address-&amp;gt;firstName 			= $contact_first;
							$address-&amp;gt;lastName 			= $contact_last;
							//$address-&amp;gt;company			= "John Doe Company";
							$address-&amp;gt;address 			= $contact_address;
							$address-&amp;gt;city 					= $contact_city;
							$address-&amp;gt;state 				= $contact_st;
							$address-&amp;gt;zip 					= 	$contact_zip;
							//$address-&amp;gt;country	 		= "USA";
							$address-&amp;gt;phoneNumber 	= $contact_phone;
							//$address-&amp;gt;faxNumber 		= "555-555-5556";
							$response = $request-&amp;gt;createCustomerShippingAddress($customerProfileId, $address);
							$customerAddressId = $response-&amp;gt;getCustomerAddressId();
							//$customerPaymentID = $response-&amp;gt;getCustomerPaymentProfileIds();
							
							// Update database with profile id
							
					
							
							UpdateContactCIM($contact_id,$customerProfileId,$customerAddressId,$paymentProfileId ,$db);
							// Create Payment 
						
							
							echo "1|".$customerProfileId."-".$customerAddressId." - ".$paymentProfileId. "- ";
					}
					else
					{
							echo "0|".$response-&amp;gt;xml-&amp;gt;messages-&amp;gt;message-&amp;gt;text;
					}
	}
	else
	{
		echo "0|Internal Error-create profile";	
	}
}&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;In my config file I have the log in an pass set to the live credentials.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;define("AUTHORIZENET_API_LOGIN_ID", $login_id);
define("AUTHORIZENET_TRANSACTION_KEY", $trans_key);&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 02 Dec 2014 23:24:24 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/CIM-Live-getting-E00027-here-is-one-or-more-missing-or-invalid/m-p/49029#M24651</guid>
      <dc:creator>skirider</dc:creator>
      <dc:date>2014-12-02T23:24:24Z</dc:date>
    </item>
    <item>
      <title>Re: CIM Live getting E00027 here is one or more missing or invalid required fields</title>
      <link>https://community.developer.cybersource.com/t5/Integration-and-Testing/CIM-Live-getting-E00027-here-is-one-or-more-missing-or-invalid/m-p/49030#M24652</link>
      <description>&lt;P&gt;Login into your merchant account&lt;/P&gt;&lt;P&gt;Account Settings - Payment Forms - Form Fields - Check to see which fields is checked as required.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And the Doc said 290 is&lt;/P&gt;&lt;DIV&gt;One or more required AVS values for zero dollar authorization were not submitted.&lt;/DIV&gt;&lt;DIV&gt;When submitting authorization requests for Visa, you must enter the address and zip code fields.&lt;/DIV&gt;</description>
      <pubDate>Wed, 03 Dec 2014 00:04:56 GMT</pubDate>
      <guid>https://community.developer.cybersource.com/t5/Integration-and-Testing/CIM-Live-getting-E00027-here-is-one-or-more-missing-or-invalid/m-p/49030#M24652</guid>
      <dc:creator>RaynorC1emen7</dc:creator>
      <dc:date>2014-12-03T00:04:56Z</dc:date>
    </item>
  </channel>
</rss>

