Reply
Highlighted
Member
Posts: 6
Registered: ‎05-08-2012
Accepted Solution

createCustomerProfileTransaction Error

I am trying to create a transaction and I am getting this weird XML error. Any ideas what is going wrong?

"Name cannot begin with the '0' character, hexadecimal value 0x30. Line 2, position 404." 

 

Here is my call. I have the amount, the customerID, the billingID, and the shippingID all populated correctly.

 

$request = new AuthorizeNetCIM;
// Create Auth & Capture Transaction
$transaction = new AuthorizeNetTransaction;
$transaction->amount = $amount;
$transaction->customerProfileId = $customer_id;
$transaction->customerPaymentProfileId = $billing_id;
$transaction->customerShippingAddressId = $shipping_id;

$response = $request->createCustomerProfileTransaction("AuthCapture", $transaction);

 

Thank you!

Rick


Accepted Solutions
Highlighted
Solution
Accepted by RichardH (Administrator)
‎08-21-2015 01:58 AM
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: createCustomerProfileTransaction Error

[ Edited ]

Authorize.net's PHP API returns a SimpleXMLElement for each item, so if you take the payment ID from the response from getCustomerProfile and then pass it back to createCustomerProfileTransaction (for instance), it's passing the key (0) instead of the value (the payment ID). To fix this, add (string) before the value, like so:

 

$transaction->customerPaymentProfileID = (string) $profile->xml->profile->paymentProfiles[0]->customerPaymentProfileId;

I just ran into this problem myself, and while it didn't take me long to figure out, that was because I've run into this sort of problem before with SimpleXMLElement and I know it's extremely confusing the first time it happens.

View solution in original post


All Replies
Highlighted
Administrator Administrator
Administrator
Posts: 563
Registered: ‎08-03-2011

Re: createCustomerProfileTransaction Error

Hi rickpost80498,

 

I just ran your code as provided and did not encounter any errors.  I can only assume that the error is being caused by what you are entering as your inputs.  Because the error references the "name" element, it is most likely due to the API login ID that you are entering.

 

Thanks,

Joy

Highlighted
Contributor
Posts: 11
Registered: ‎11-17-2012

Re: createCustomerProfileTransaction Error

I am getting this same error using the CIM system, I am sending the transaction with the account/payment/shipping ids and getting this back as an error.

 

                            [code] => E00003

                            [text] => Name cannot begin with the '0' character, hexadecimal value 0x30. Line 2, position 341.

Highlighted
Solution
Accepted by RichardH (Administrator)
‎08-21-2015 01:58 AM
Posts: 1,609
Topics: 15
Kudos: 201
Solutions: 121
Registered: ‎06-23-2011

Re: createCustomerProfileTransaction Error

[ Edited ]

Authorize.net's PHP API returns a SimpleXMLElement for each item, so if you take the payment ID from the response from getCustomerProfile and then pass it back to createCustomerProfileTransaction (for instance), it's passing the key (0) instead of the value (the payment ID). To fix this, add (string) before the value, like so:

 

$transaction->customerPaymentProfileID = (string) $profile->xml->profile->paymentProfiles[0]->customerPaymentProfileId;

I just ran into this problem myself, and while it didn't take me long to figure out, that was because I've run into this sort of problem before with SimpleXMLElement and I know it's extremely confusing the first time it happens.

Highlighted
Member
Posts: 3
Registered: ‎06-18-2014

Re: createCustomerProfileTransaction Error

+1 for TJPride's response.  That was the solution for me.