cancel
Showing results for 
Search instead for 
Did you mean: 

XML problem updating CIM profile. Error E00003

I'm working on a project that uses what appears to be a slightly older version of the PHP SDK. Sadly, the PHP code does not appear to specify any version for the SDK. I have constructed code using this SDK that is supposed to update a CIM profile. I keep getting this error though:

Error
        Message: The element 'creditCard' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd' has invalid child element 'expirationDate' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'. List of possible elements expected: 'cardNumber' in namespace 'AnetApi/xml/v1/schema/AnetApiSchema.xsd'.
        E00003

 

It appears to be generating this XML which causes the problem:

 

<?xml version="1.0" encoding="utf-8"?>
<updateCustomerPaymentProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
	<merchantAuthentication>
		<name>XXXXXXXXX</name>
		<transactionKey>YYYYYYYY</transactionKey>
	</merchantAuthentication>
	<customerProfileId>AAAAAAAA</customerProfileId>
	<paymentProfile>
		<customerType>individual</customerType>
		<payment>
			<creditCard>
				<expirationDate>2022-06</expirationDate>
				<cardCode>456</cardCode>
			</creditCard>
		</payment>
		<customerPaymentProfileId>BBBBBBBB</customerPaymentProfileId>
	</paymentProfile>
</updateCustomerPaymentProfileRequest>

 

I've been trying to figure out what's wrong with this XML by checking the API:

http://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-pr...

 

But I'm really just doing trial and error.  Can someone help me sort this?  My code looks something like this:

$authorizenet_cim_request = new AuthorizeNetCIM($this->conf_api_login_id, $this->conf_api_transaction_key);
$authorizenet_cim_request->setSandbox($this->conf_sandbox);
$authorizenet_cim_request->setLogFile($this->conf_log_file);

$paymentProfile = new AuthorizeNetPaymentProfile;
$paymentProfile->customerType = "individual";
$paymentProfile->payment->creditCard->expirationDate = "2022-06";
$paymentProfile->payment->creditCard->cardCode = "456";

$transaction_result = $authorizenet_cim_request->updateCustomerPaymentProfile("AAAAAAAA", "BBBBBBBB", $paymentProfile);

Any help would be much appreciated.

 

 

sneakyimp
Contributor
4 REPLIES 4

http://developer.authorize.net/api/reference/index.html#customer-profiles-update-customer-payment-pr...

The sequence matter. and you need the credit card# "Number can also be masked, for example, XXXX1111"

Usually you do a get payment profile, then do a update with the masked card#.

RaynorC1emen7
Expert

OK supplying the masked credit card number (which seems really silly to me) is a very helpful tip.

 

With some trial-and-error, I've managed to get something working with the sandbox API.

 

Apparently the API docs are wrong. When you don't supply values, rather than the API blanking these in the system, it leaves the prior setting -- at least in most cases -- with the sandbox.

re: sequence matter

 

What??? Seriously?!?! XML is OOP and sequence shouldn't matter if it's compliant xml. And how do you suppose one gets the sequence right using your github api that uses SimpleXMLElement with it's ->toXml() method which appears to jumble the order? (I added the elements in order, it seems to have changed the order when creating the xml output)

woops, the SimpleXMLElement method is ->asXML()