来自PayPal的交易详情使用Android中的Pay-key

我在我的应用程序中集成了paypal,一切都运行正常。现在我想在我的android中拥有来自paypal的所有交易细节,所以使用paykey我试着编写代码。我获取交易细节的代码如下:

if(resultTitle == "SUCCESS") { try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = null; httppost = new HttpPost("https://svcs.sandbox.paypal.com/AdaptivePayments/PaymentDetails"); httppost.setHeader("Content-Type", "application/x-www-form-urlencoded"); // Add your data List nameValuePairs = new ArrayList(); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-SECURITY-USERID", "parth_1325956186_biz_api1.bcod.co.in")); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-SECURITY-PASSWORD", "334367211")); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-SECURITY-SIGNATURE", "An5ns1Kso7MUDHR4ErQKJJJ4qi4-AI0T5BBCHc3gWzBV9Q81jcP6LFD6")); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-APPLICATION-ID", "APP-80W284485P519543T")); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-REQUEST-DATA-FORMAT", "nv")); nameValuePairs.add(new BasicNameValuePair("X-PAYPAL-RESPONSE-DATA-FORMAT", "nv")); nameValuePairs.add(new BasicNameValuePair("payKey", resultExtra)); nameValuePairs.add(new BasicNameValuePair("requestEnvelope.errorLanguage", "en_US")); httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs)); HttpResponse response = httpclient.execute(httppost); HttpEntity entity = response.getEntity(); InputStream is = entity.getContent(); byte[] data1; data1 = new byte[256]; buffer = new StringBuffer(); int len = 0; while (-1 != (len = is.read(data1)) ) { buffer.append(new String(data1, 0, len)); } Log.e("log_tag",""+buffer.toString()); //Make the comparison case-insensitive. is.close(); }catch(Exception e) { Log.e("","error "+ e ); } Log.e("","resultExtra "+ resultExtra ); Intent go = new Intent(getBaseContext(),membership_pack_clear.class); startActivity(go); finish(); } 

我得到了他们的回复

   2012-01-09T05:16:35.886-08:00 Failure aa06daf9a0985 2279004 520003 PLATFORM Application Error Application Authentication failed. API credentials are incorrect.  

任何人都可以帮助我为什么我会收到此错误,或者可以给我一些示例如何从paypal获取交易详情。

请求付款详细信息的正确方法是:

 httppost.setHeader("X-PAYPAL-SECURITY-USERID", "parth_1325956186_biz_api1.bcod.co.in"); httppost.setHeader("X-PAYPAL-SECURITY-PASSWORD", "334367211"); httppost.setHeader("X-PAYPAL-SECURITY-SIGNATURE", "An5ns1Kso7MUDHR4ErQKJJJ4qi4-AI0T5BBCHc3gWzBV9Q81jcP6LFD6"); httppost.setHeader("X-PAYPAL-APPLICATION-ID", "APP-80W284485P519543T"); httppost.setHeader("X-PAYPAL-REQUEST-DATA-FORMAT", "NV"); httppost.setHeader("X-PAYPAL-RESPONSE-DATA-FORMAT", "NV"); 

并设置正文内容使用:

 List nameValuePairs = new ArrayList(); nameValuePairs.add(new BasicNameValuePair("payKey", "AP-4DJ54615WA356150J")); nameValuePairs.add(new BasicNameValuePair("requestEnvelope.errorLanguage", "en_US")); 

然后正常执行。