0
votes

I am struggling with last couple of days with Authorize.net processing.

I am using Test mode and test card details.

I am getting the error : E0007 - User authentication failed due to invalid authentication values.

This is the code which I am using.

$content =
        "<?xml version=\"1.0\" encoding=\"utf-8\"?>" .
        "<createCustomerPaymentProfileRequest xmlns=\"AnetApi/xml/v1/schema/AnetApiSchema.xsd\">" .
        "<merchantAuthentication>".
        "<name>" . $this->g_loginname . "</name>".
        "<transactionKey>" . $this->g_transactionkey . "</transactionKey>".
        "</merchantAuthentication>".
        "<customerProfileId>" . $cid . "</customerProfileId>".
        "<paymentProfile>".
        "<customerType>individual</customerType>".
        "<billTo>".
         "<firstName>".$vars['fname']."</firstName>".
         "<lastName>".$vars['lname']."</lastName>".
         "<company>".$vars['company']."</company>".
         "<address>".$vars['baddress']."</address>".
         "<city>".$vars['bcity']."</city>".
   "<state>".$vars['bstate']."</state>".
     "<zip>".$vars['bzip']."</zip>".
     "<country>USA</country>".
         "<phoneNumber>".$vars['phone']."</phoneNumber>".
        "</billTo>".
        "<payment>".
         "<creditCard>".
          "<cardNumber>".$vars['ccno']."</cardNumber>".
          "<expirationDate>20".$exp_date[1].'-'.$exp_date[0]."</expirationDate>". // required format for API is YYYY-MM
          "<cardCode>".$vars['ccv']."</cardCode>".
         "</creditCard>".
        "</payment>".
        "</paymentProfile>".
        "<validationMode>testMode</validationMode>". // or testMode
        "</createCustomerPaymentProfileRequest>";

This is final posting content after parsing the XML.

<?xml version="1.0" encoding="utf-8"?>
   <createCustomerPaymentProfileRequest           xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
 <merchantAuthentication>
  <name>5EmThCM9ba6w</name>
  <transactionKey>29EFx88Vw9m3c73k</transactionKey>
</merchantAuthentication>
<customerProfileId>1000</customerProfileId>
<paymentProfile>
<customerType>individual</customerType>
<billTo>
  <firstName>sasa</firstName>
  <lastName> dfsdfsd</lastName>
  <company>Software</company>
  <address>sasa</address>
  <city>sa</city>
  <state>AZ</state>
  <zip>23223</zip>
  <country>USA</country>
  <phoneNumber>323-232-2323</phoneNumber>
</billTo>
<payment>
  <creditCard><cardNumber>4012888888881881</cardNumber>
    <expirationDate>2017-12</expirationDate>
    <cardCode>232</cardCode>
  </creditCard>
</payment>
</paymentProfile>
<validationMode>testMode</validationMode>

This is the XML which i am getting. I am using Test cards details in Test mode. I am not able to understand how I am getting user credentials wrongerror message. Please check XML once.

1
Hi Friends, any help please. - robert
The error message is very clear. Your credentials are incorrect. First echo out your XML and make sure you see your variables values. If you do, next make sure your credentials are correct. - John Conde
@JohnConde Thanks for your response. I added the XML on my original post. Yes, it is very clear. But, I cross checked so many times with XML. I am not able to find where its going wrong. Please suggest - robert

1 Answers

0
votes

Finally I got it. I made a miske regarding Host Url. I used api.authorize.net. actually we should use apitest.authorize.net for test account.