无法使用authorize.net CIM和带有开发测试帐户的活动商家创建客户个人资料

时间:2012-11-09 20:42:38

标签: ruby-on-rails authorize.net activemerchant

我使用authorize.net创建了一个开发者帐户,我正在尝试通过activemerchant创建客户个人资料。

> GATEWAY.create_customer_profile(:profile => { :merchant_customer_id => "123foobar", :email => "lol@lol.com" })

#<ActiveMerchant::Billing::Response:0x007fc3a2663e20 @params={"messages"=>
{"result_code"=>"Error", "message"=>{"code"=>"E00007", "text"=>"User authentication failed 
due to invalid authentication values."}}}, @message="User authentication failed due to 
invalid authentication values.", @success=false, @test=false, @authorization=nil, 
@fraud_review=nil,
@avs_result={"code"=>nil, "message"=>nil, "street_match"=>nil, "postal_match"=>nil},
@cvv_result={"code"=>nil, "message"=>nil}> 

我查了那个错误代码并说:

API Error Code: E00007
Error Code Text: User authentication failed due to invalid authentication values.
Description: The name/and or transaction key is invalid.
Other Tips: Try switching between production and developer test URL's. The test URL     
requires a separate developer test account, which can be set up by filling out the following form: http://developer.authorize.net/testaccount.

为了确定,我验证了api登录密钥。当我检查网关对象时,我看到登录(api登录密钥),密码(事务密钥)和:test =&gt;真

谁能告诉我这笔交易是什么?


更新

所以我决定最好绝对验证问题是在authorize.net上---结果是,它不是..如果我通过curl做请求,那就成功了:

    curl -H "Accept: application/xml" -H "Content-Type: application/xml" -X POST -d '<?xml version="1.0" encoding="utf-8"?>
    <createCustomerProfileRequest xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd">
      <merchantAuthentication>
        <name>myTestLogin</name>
        <transactionKey>myTransactionKey</transactionKey>
      </merchantAuthentication>
      <profile>
        <merchantCustomerId>custId123</merchantCustomerId>
        <description>some description</description>
        <email>foo@bar.com</email>
      </profile>
    </createCustomerProfileRequest>' https://apitest.authorize.net/xml/v1/request.api


      <?xml version="1.0" encoding="utf-8"?><createCustomerProfileResponse xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="AnetApi/xml/v1/schema/AnetApiSchema.xsd"><messages><resultCode>Ok</resultCode><message><code>I00001</code><text>Successful.</text></message></messages><customerProfileId>10521778</customerProfileId><customerPaymentProfileIdList /><customerShippingAddressIdList /><validationDirectResponseList /></createCustomerProfileResponse>

...

所以,这意味着问题在于ActiveMerchant ........我可以通过activemerchant在我的实时真实帐户中创建客户资料,但出于某种原因,我不能对开发人员这样做测试帐户...

有一件事让我怀疑:

尽管网关说它处于测试模式: 1.9.3p194:007&gt; GATEWAY  =&GT; #,:password =&gt;,:test =&gt; true}&gt;

实际上询问它是否处于测试模式会返回意外的响应........

1.9.3p194 :008 > GATEWAY.test?
 => false 

... hmmmmmmmmmmm

1 个答案:

答案 0 :(得分:0)

测试模式并将test设置为true是两回事。如果您的帐户处于测试模式,则应将test设置为false或根本不发送。

更好的是,如果您正在开发应用程序,则应使用Authorize.Net注册developer account。这样您就不必处理测试模式或参数,因为开发人员帐户基本上始终处于测试模式。它们就像生产帐户一样,但实际上并不处理任何付款。它使开发更容易,更安全。