cancel
Showing results for 
Search instead for 
Did you mean: 

ARB error code 00003

I keep receiving this error code which means "XML Parser Error"

 

Is it the code below??

 

$content ='<?xml version="1.0" encoding="utf-8"?>' .
        '<ARBCreateSubscriptionRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">' .
        '<merchantAuthentication>'.
        '<name>' . $loginname . '</name>'.
        '<transactionKey>' . $transactionkey . '</transactionKey>'.
        '</merchantAuthentication>'.
       '<refId>' . $refid . '</refId>'.  
       '<subscription>'.
        '<paymentSchedule>'.
        '<interval>'.
        '<length>'. $length .'</length>'.
        '<unit>'. $unit .'</unit>'.
        '</interval>'.
        '<startDate>' . $startDate . '</startDate>'.
        '<totalOccurrences>'. $totalOccurrences . '</totalOccurrences>'.
        '</paymentSchedule>'.
        '<amount>'. $amount .'</amount>'.
        '<payment>'.
        '<creditCard>'.
        '<cardNumber>' . $cardNumber . '</cardNumber>'.
        '<expirationDate>' . $expirationDate . '</expirationDate>'.
        '<cardCode>' . $cardCode . '</cardCode>'.
        '</creditCard>'.
        '</payment>'.
        '<customer>'.
        '<email>'. $email . '</email>'.
        '</customer>'.
        '<billTo>'.
        '<firstName>'. $firstName . '</firstName>'.
        '<lastName>' . $lastName . '</lastName>'.
        '<address>' . $address . '</address>'.
        '<city>' . $city . '</city>'.
        '<state>' . $state . '</state>'.
        '<zip>' . $zip . '</zip>'.
        '</billTo>'.
        '</subscription>'.
        '</ARBCreateSubscriptionRequest>';


//send the xml via curl
$response = send_request_via_curl($host,$path,$content);

 

mraccine
Member
11 REPLIES 11

Instead of posting the PHP, post the XML after it has been processed by PHP so we can see the actual XML Authnet is receiving. That will make troubleshooting a lot easier.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post
stymiee
Expert
Expert

I'm getting the same error. Below is the XML (hope it's ok to tag along on this thread since it's the same issue)

The stuff in red is what I obviously had to change. Also changed name and email.

Thanks

 

<?xml version='1.0' encoding='utf-8'?>
<ARBCreateSubscriptionRequest xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'>
  <merchantAuthentication>
      <name>(AUTH)</name>
      <transactionKey>(KEY)</transactionKey>
  </merchantAuthentication>
  <refId>Monthly Membership</refId>
  <subscription>
      <name></name>
      <paymentSchedule>
          <interval>
              <length>1</length>
              <unit>months</unit>
          </interval>
          <startDate>2012-02-05</startDate>
          <totalOccurrences>9999</totalOccurrences>
          <trialOccurrences>0</trialOccurrences>
      </paymentSchedule>
      <amount>14.99</amount>
      <trialAmount>0</trialAmount>
      <payment>
          <creditCard>
              <cardNumber>1111111111111111</cardNumber>
              <expirationDate>2-2014</expirationDate>
          </creditCard>
      </payment>
      <order>
          <invoiceNumber></invoiceNumber>
          <description></description>
      </order>
      <customer>
          <id></id>
          <email>jdoe@domain.com</email>
          <phoneNumber></phoneNumber>
          <faxNumber></faxNumber>
      </customer>
      <billTo>
          <firstName>John</firstName>
          <lastName>Doe</lastName>
          <company></company>
          <address></address>
          <city></city>
          <state></state>
          <zip></zip>
      </billTo>
      <shipTo>
          <firstName></firstName>
          <lastName></lastName>
          <company></company>
          <address></address>
          <city></city>
          <state></state>
          <zip></zip>
      </shipTo>
  </subscription>
</ARBCreateSubscriptionRequest>

Does it say where the parse error is? Can you paste the exact error message here for us?


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

Your code works for me:

 

<?xml version="1.0" encoding="utf-8"?>
<ARBCreateSubscriptionResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
  <refId>Monthly Membership</refId>
  <messages>
    <resultCode>Ok</resultCode>
    <message>
      <code>I00001</code>
      <text>Successful.</text>
    </message>
  </messages>
  <subscriptionId>1266044</subscriptionId>
</ARBCreateSubscriptionResponse>

 


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

I'm using the PHP ARB code from your tutorial...

 

if ($subscription->isSuccessful()) {

     $subscription_id = $subscription->getSubscriberID() ;    // Get the subscription ID from success    
      // update the db

     // redirect to thank you page
}
elseif($subscription->isError()) {   
     // sends an email with the error and dumps the reponse

     $message  = "Error Type: ".$subscription->getResponseCode()." occured.<pre> \n\rData : ".$subscription."</pre>";

     ...

}

The code pasted above was the xml that came back as part of the dump. Is there something I can add to get more error reporting when it fails?

Just in case... this the full copy that is dumped when it fails. I'm wondering if the encode less than (&lt;) part in the xml is an issue? Also in the xml there's nothing for parameter "name" but there is in the html table of data at above it... not sure why that may be?

 

Thanks

D.

 

// --- code begins here ---

 

Error Type: E00003 occured.<pre>

Data : <table summary="Authnet Results" id="authnet">
<tr>
                <th colspan="2"><b>Outgoing Parameters</b></th>
</tr>
        <tr>
                <td><b>interval_length</b></td><td>1</td>
</tr>
        <tr>
                <td><b>interval_unit</b></td><td>months</td>
</tr>
        <tr>
                <td><b>startDate</b></td><td>2012-02-05</td>
</tr>
        <tr>
                <td><b>totalOccurrences</b></td><td>9999</td>
</tr>
        <tr>
                <td><b>trialOccurrences</b></td><td>0</td>
</tr>
        <tr>
                <td><b>trialAmount</b></td><td>0</td>
</tr>
        <tr>
                <td><b>refID</b></td><td>Monthly Membership</td>
</tr>
        <tr>
                <td><b>name</b></td><td>Purchase</td>
</tr>
        <tr>
                <td><b>amount</b></td><td>14.99</td>
</tr>
        <tr>
                <td><b>cardNumber</b></td><td>1111222233334444</td>
</tr>
        <tr>
                <td><b>expirationDate</b></td><td>2-2014</td>
</tr>
        <tr>
                <td><b>firstName</b></td><td>John</td>
</tr>
        <tr>
                <td><b>lastName</b></td><td>Doe</td>
</tr>
        <tr>
                <td><b>email</b></td><td>jdoe@domain.com</td>
</tr>
</table>
XML:
<pre>
&lt;?xml version='1.0' encoding='utf-8'?&gt;
                      &lt;ARBCreateSubscriptionRequest xmlns='AnetApi/xml/v1/schema/AnetApiSchema.xsd'&gt;
                          &lt;merchantAuthentication&gt;
                              &lt;name&gt;XXXXXXXXXXX&lt;/name&gt;
                              &lt;transactionKey&gt;XXXXXXXXX&lt;/transactionKey&gt;
                          &lt;/merchantAuthentication&gt;
                          &lt;refId&gt;Monthly Membership&lt;/refId&gt;
                          &lt;subscription&gt;
                              &lt;name&gt;&lt;/name&gt;
                              &lt;paymentSchedule&gt;
                                  &lt;interval&gt;
                                      &lt;length&gt;1&lt;/length&gt;
                                      &lt;unit&gt;months&lt;/unit&gt;
                                  &lt;/interval&gt;
                                  &lt;startDate&gt;2012-02-05&lt;/startDate&gt;
                                  &lt;totalOccurrences&gt;9999&lt;/totalOccurrences&gt;
                                  &lt;trialOccurrences&gt;0&lt;/trialOccurrences&gt;
                              &lt;/paymentSchedule&gt;
                              &lt;amount&gt;14.99&lt;/amount&gt;
                              &lt;trialAmount&gt;0&lt;/trialAmount&gt;
                              &lt;payment&gt;
                                  &lt;creditCard&gt;
                                      &lt;cardNumber&gt;1111222233334444&lt;/cardNumber&gt;
                                      &lt;expirationDate&gt;2-2014&lt;/expirationDate&gt;
                                  &lt;/creditCard&gt;
                              &lt;/payment&gt;
                              &lt;order&gt;
                                  &lt;invoiceNumber&gt;&lt;/invoiceNumber&gt;
                                  &lt;description&gt;&lt;/description&gt;
                              &lt;/order&gt;
                              &lt;customer&gt;
                                  &lt;id&gt;&lt;/id&gt;
                                  &lt;email&gt;j.doe@domain.com&lt;/email&gt;
                                  &lt;phoneNumber&gt;&lt;/phoneNumber&gt;
                                  &lt;faxNumber&gt;&lt;/faxNumber&gt;
                              &lt;/customer&gt;
                              &lt;billTo&gt;
                                  &lt;firstName&gt;John&lt;/firstName&gt;
                                  &lt;lastName&gt;Doe&lt;/lastName&gt;
                                  &lt;company&gt;&lt;/company&gt;
                                  &lt;address&gt;&lt;/address&gt;
                                  &lt;city&gt;&lt;/city&gt;
                                  &lt;state&gt;&lt;/state&gt;
                                  &lt;zip&gt;&lt;/zip&gt;
                              &lt;/billTo&gt;
                              &lt;shipTo&gt;
                                  &lt;firstName&gt;&lt;/firstName&gt;
                                  &lt;lastName&gt;&lt;/lastName&gt;
                                  &lt;company&gt;&lt;/company&gt;
                                  &lt;address&gt;&lt;/address&gt;
                                  &lt;city&gt;&lt;/city&gt;
                                  &lt;state&gt;&lt;/state&gt;
                                  &lt;zip&gt;&lt;/zip&gt;
                              &lt;/shipTo&gt;
                          &lt;/subscription&gt;
                      &lt;/ARBCreateSubscriptionRequest&gt;
</pre>
</pre>


The name field is definitely empty in the XML you're pasting above. Instead of going through all of your code, just for fun, try using the ARB Class I attached to this post and let me know if it works for you. It's newer and more polished. I am assuming you're using PHP 5.2 or newer.

 

It's usage is a little different:

 

$arb = new AuthnetARB('apilogin','apitransactionkley');
$arb->setParameter('amount', $total);
$arb->setParameter('cardNumber', $credit_card);
$arb->setParameter('expirationDate', $expiration);
$arb->setParameter('firstName', $b_first_name);
$arb->setParameter('lastName', $b_last_name);
$arb->setParameter('address', $b_address);
$arb->setParameter('city', $b_city);
$arb->setParameter('state', $b_state);
$arb->setParameter('zip', $b_zip);
$arb->setParameter('email', $email);
$arb->createSubscription();

As you can see you pass api login and transaction in the constructor. And you call createSubscription() to create the subscription (duh!). But otherwise it's more or less the same. The other changes are all under the hood.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post

I grabbed your new version and did a compare to what I was running. They're almost identical, but in my version, I saw...

 if (!empty($this->response))
{
    /* -- not working??
    $dom = new DOMDocument('1.0');
    $dom->preserveWhiteSpace = false;
    $dom->formatOutput = true;		
    $dom->loadXML($this->response);
    $response = $dom->saveXML();

    $output .= '<br><br>' . "\n";
    $output .= 'Response: ' . "\n";
    $output .= '<pre>' . "\n";
    $output .= htmlentities($response) . "\n";
    $output .= '</pre>' . "\n";
    */
    /* maybe use this
    $this->parseResults();
    if ($this->resultCode === 'Ok')
    {
        $this->success = true;
        $this->error   = false;
        }
        else
        {
            $this->success = false;
            $this->error   = true;
        }
        */	
} 

 

In the version I have some code was commented out... I'm assuming it's something I did for some reason b/c of an error I was gettting. I may have added the second part based on another tutorial I was working with, so I apologize if it's way off...

 

the other thing I notices that was different is that I have changed $this-> to @$this-> in some places on the page. I think I was getting an error thrown for undefined variables for things like shipping address, so that was my work around..

 

The php code I'm using to call the class is here:

// Set up the subscription. Use the developer account for testing..
$subscription = new AuthnetARB($login, $transcode, $test_mode);

// Set subscription information
$subscription->setParameter('refID', $submit_info_array['refId']);
$subscription->setParameter('name', $submit_info_array['name']);
$subscription->setParameter('amount', $submit_info_array['amount']);
$subscription->setParameter('cardNumber', $submit_info_array['cardNumber']);
$subscription->setParameter('expirationDate', $submit_info_array['expirationDate']);
$subscription->setParameter('firstName', $submit_info_array['firstName']);
$subscription->setParameter('lastName', $submit_info_array['lastName']);
$subscription->setParameter('email', $_SESSION['email']);

// Set the billing cycle for every 1 or 12 months
$subscription->setParameter('interval_length', $submit_info_array['length']);

// set the start to begin one interval (month/year) ahead of the current paid subscription
$subscription->setParameter('startDate', $submit_info_array['arbSstartDate']);
 
// Create the subscription
$subscription->createSubscription();

// Check the results of our API call
if ($subscription->isSuccessful()) {

 

It's close to what you have but I'm sending some additional params, and not sending some of what you included in your example above. The $submit_info_array is just an array of items that have already been filtered/sanitized.

 

Finally... what is the best way to test this without waiting for a "live" purchase. I don't believe ARB will fire in the sandbox, but I may be wrong. I really appreciate all the help!

 

D.

Looks like you have a recent copy of the ARB class which is good. ARB will work just fine with the developer account. Just set the third parameter in the constructor to true and you're all set. In fact you can verify that playing with it here. You can test your ARB XML against the development server to verify it is correct.

 

The code you have provide looks good assuming everything in your $submit_info_array is okay. Just the fact that you mentioned that you filtered and sanitized it makes me confident that it is okay. 99% of the users who post here have no idea what those concepts are! 

 

There's a little gotcha somwhere we're not looking. If you want I don't mind taking a peek at your script for you.


-------------------------------------------------------------------------------------------------------------------------------------------
John Conde :: Certified Authorize.Net Developer (Brainyminds) :: Official Authorize.Net Blogger

NEW! Handling Authorize.Net's Webhooks with PHP

Integrate Every Authorize.Net JSON API with One PHP Class (Sample code included)

Tutorials for integrating Authorize.Net with PHP: AIM, ARB, CIM, Silent Post
All About Authorize.Net's Silent Post