2013-08-21 70 views
0

我得到驗證從貝寶沙盒失敗,我將請求發送到薪酬朋友作爲一個名稱值對..PayPal自適應付款驗證失敗,輸入是名稱值對。在java中

代碼如下:`

final String PayPalConstants.ENCODE_TYPE="UTF-8"; 
final StringBuffer encodedStringBuffer = new StringBuffer(); 
encodedStringBuffer.append("X-PAYPAL-SECURITY-USERID=" + URLEncoder.encode(getAdaptivePaymentUserName(), PayPalConstants.ENCODE_TYPE) + "&"); 
    encodedStringBuffer.append("X-PAYPAL-SECURITY-PASSWORD=" + URLEncoder.encode(getAdaptivePaymentPassword(), PayPalConstants.ENCODE_TYPE) + "&"); 
    if (!isUseCert()) { 
     encodedStringBuffer.append("X-PAYPAL-SECURITY-SIGNATURE=" + URLEncoder.encode(getAdaptivePaymentSignature(), PayPalConstants.ENCODE_TYPE) + "&"); 
    } 
    // encodedStringBuffer.append("BUTTONSOURCE=" + 
    // URLEncoder.encode(PayPalConstants.BUTTONSOURCE, 
    // PayPalConstants.ENCODE_TYPE) + "&"); 
    encodedStringBuffer.append("X-PAYPAL-REQUEST-DATA-FORMAT=" + URLEncoder.encode("NV", PayPalConstants.ENCODE_TYPE) + "&"); 
    encodedStringBuffer.append("X-PAYPAL-RESPONSE-DATA-FORMAT=" + URLEncoder.encode("NV", PayPalConstants.ENCODE_TYPE) + "&"); 
    encodedStringBuffer.append("X-PAYPAL-APPLICATION-ID=" + URLEncoder.encode(getAdaptivePaymentAppId(), PayPalConstants.ENCODE_TYPE) + "&"); 

       final PostMethod httpPost = new PostMethod(this.adaptivePaymentRestURL.getPath()); 

    httpPost.setRequestEntity(new StringRequestEntity(encodedStringBuffer.toString(), "text/html", PayPalConstants.ENCODE_TYPE)); 
final int result = this.adaptivePaymentHttpClient.executeMethod(httpPost); 
        if (result == 200) { 
      response = httpPost.getResponseBodyAsString(); 
} 

並且響應值如下:

<?xml version='1.0' encoding='UTF-8'?> 
<ns3:FaultMessage xmlns:ns3="http://svcs.paypal.com/types/common" xmlns:ns2="http://svcs.paypal.com/types/ap"> 
<responseEnvelope> 
<timestamp>2013-08-21T00:20:51.291-07:00</timestamp> 
<ack>Failure</ack> 
<correlationId>e3325********</correlationId> 
<build>694****</build> 
</responseEnvelope> 
<error> 
**<errorId>520003</errorId>** 
<domain>PLATFORM</domain> 
<subdomain>Application</subdomain> 
<severity>Error</severity> 
<category>Application</category> 
<message>Authentication failed. API credentials are incorrect.</message> 
</error> 
</ns3:FaultMessage> 

所以任何人都可以請告訴我我做錯了什麼? 輸入字符串緩衝區是否是此webservice的錯誤數據類型。 請幫我..我完全困惑於此。

在此先感謝。

回答