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
Solved! Go to Solution.
05-08-2012 08:48 AM
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.
12-01-2012 08:25 PM - edited 12-01-2012 08:25 PM
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
05-16-2012 02:09 PM
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.
11-17-2012 03:16 PM
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.
12-01-2012 08:25 PM - edited 12-01-2012 08:25 PM
+1 for TJPride's response. That was the solution for me.
06-18-2014 10:37 AM