cancel
Showing results for 
Search instead for 
Did you mean: 

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

rickpost80498
Member
1 ACCEPTED SOLUTION

Accepted Solutions

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

4 REPLIES 4

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

Joy
Administrator Administrator
Administrator

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.

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.

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