2015-03-02 23 views
0

我與過去幾天與Authorize.net處理掙扎。PHP:Authorize.Net錯誤,而使用XML AIM

我使用的測試模式以及測試卡的詳細信息。

我收到錯誤:E0007 - 由於認證值無效,用戶認證失敗。

這是我使用的代碼。

$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>"; 

這是解析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> 

這是我收到的XML。我正在測試模式下使用測試卡細節。我無法理解我如何獲取用戶憑證wrongerror消息。請檢查XML一次。

+0

嗨朋友,請任何幫助。 – robert 2015-03-02 09:23:55

+0

錯誤信息非常清楚。您的憑據不正確。首先回顯你的XML,並確保你看到你的變量值。如果你這樣做,下一步確保你的憑證是正確的。 – 2015-03-03 00:58:56

+0

@JohnConde感謝您的回覆。我在原始帖子中添加了XML。是的,這很清楚。但是,我用XML進行了很多次檢查。我無法找到它出錯的地方。請建議 – robert 2015-03-03 04:20:53

回答

0

最後我明白了。我對主機網址做了一個錯誤。我用api.authorize.net。實際上,我們應該使用apitest.authorize.net作爲測試帳戶。