【发布时间】:2015-05-02 11:28:28
【问题描述】:
最近几天我在 Authorize.net 处理方面苦苦挣扎。
我正在使用测试模式和测试卡详细信息。
我收到错误: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。我在测试模式下使用测试卡详细信息。我无法理解如何获取用户凭据错误消息。请检查一次 XML。
【问题讨论】:
-
嗨朋友们,请帮忙。
-
错误信息很清楚。您的凭据不正确。首先回显您的 XML 并确保您看到您的变量值。如果这样做,接下来请确保您的凭据正确。
-
@JohnConde 感谢您的回复。我在原始帖子中添加了 XML。是的,非常清楚。但是,我用 XML 交叉检查了很多次。我无法找到它出错的地方。请建议
标签: php payment-gateway authorize.net