PayPal Java NVP API GetExpressCheckoutDetails - 缺少数据

时间:2013-09-11 22:34:02

标签: java http paypal jboss nvp

我在Java Web应用程序中使用'express checkout'进程调用PayPal沙箱。第一个调用('SetExpressCheckout')成功,我按预期收到令牌。

第二次调用('GetExpressCheckoutDetails')在获得ACK =成功答案方面也取得了成功。但是,所有付款人信息数据都没有,例如FIRSTNAME,LASTNAME或SHIPTOCITY。

这是我用参数调用的URL:

https://api-3t.sandbox.paypal.com/nvp?TOKEN=__MY_TOKEN__&VERSION=106.0&SIGNATURE=__MY_SIGNATURE__&METHOD=GetExpressCheckoutDetails&PWD=__MY_PASSWORD__&USER=__MY_USERNAME__

这是我得到的回复主体:

TOKEN=__MY_TOKEN__&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2013%2d09%2d11T20%3a56%3a36Z&CORRELATIONID=bb3916c14aa78&ACK=Success&VERSION=106%2e0&BUILD=7645184&CURRENCYCODE=USD&AMT=12%2e00&SHIPPINGAMT=0%2e00&HANDLINGAMT=0%2e00&TAXAMT=0%2e00&INSURANCEAMT=0%2e00&SHIPDISCAMT=0%2e00&PAYMENTREQUEST_0_CURRENCYCODE=USD&PAYMENTREQUEST_0_AMT=12%2e00&PAYMENTREQUEST_0_SHIPPINGAMT=0%2e00&PAYMENTREQUEST_0_HANDLINGAMT=0%2e00&PAYMENTREQUEST_0_TAXAMT=0%2e00&PAYMENTREQUEST_0_INSURANCEAMT=0%2e00&PAYMENTREQUEST_0_SHIPDISCAMT=0%2e00&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None&PAYMENTREQUESTINFO_0_ERRORCODE=0

如果我将相同的请求URL放入Firefox,我会收到我期望的响应:

TOKEN=__MY_TOKEN__&CHECKOUTSTATUS=PaymentActionNotInitiated&TIMESTAMP=2013%2d09%2d11T20%3a37%3a31Z&CORRELATIONID=7804316ba643d&ACK=Success&VERSION=106%2e0&BUILD=7645184&EMAIL=mne%2dcustomer2%40m%2dn%2de%2ede&PAYERID=QRZ57KR8PHVF4&PAYERSTATUS=verified&FIRSTNAME=Frank&LASTNAME=Forest&COUNTRYCODE=US&SHIPTONAME=Frank%20Forest&SHIPTOSTREET=1%20Main%20St&SHIPTOCITY=San%20Jose&SHIPTOSTATE=CA&SHIPTOZIP=95131&SHIPTOCOUNTRYCODE=US&SHIPTOCOUNTRYNAME=United%20States&ADDRESSSTATUS=Confirmed&CURRENCYCODE=USD&AMT=15%2e00&SHIPPINGAMT=0%2e00&HANDLINGAMT=0%2e00&TAXAMT=0%2e00&INSURANCEAMT=0%2e00&SHIPDISCAMT=0%2e00&PAYMENTREQUEST_0_CURRENCYCODE=USD&PAYMENTREQUEST_0_AMT=15%2e00&PAYMENTREQUEST_0_SHIPPINGAMT=0%2e00&PAYMENTREQUEST_0_HANDLINGAMT=0%2e00&PAYMENTREQUEST_0_TAXAMT=0%2e00&PAYMENTREQUEST_0_INSURANCEAMT=0%2e00&PAYMENTREQUEST_0_SHIPDISCAMT=0%2e00&PAYMENTREQUEST_0_INSURANCEOPTIONOFFERED=false&PAYMENTREQUEST_0_SHIPTONAME=Frank%20Forest&PAYMENTREQUEST_0_SHIPTOSTREET=1%20Main%20St&PAYMENTREQUEST_0_SHIPTOCITY=San%20Jose&PAYMENTREQUEST_0_SHIPTOSTATE=CA&PAYMENTREQUEST_0_SHIPTOZIP=95131&PAYMENTREQUEST_0_SHIPTOCOUNTRYCODE=US&PAYMENTREQUEST_0_SHIPTOCOUNTRYNAME=United%20States&PAYMENTREQUEST_0_ADDRESSSTATUS=Confirmed&PAYMENTREQUEST_0_ADDRESSNORMALIZATIONSTATUS=None&PAYMENTREQUESTINFO_0_ERRORCODE=0

此预期答案包含PAYERID,FIRSTNAME,LASTNAME,SHIPTOSTREET,SHIPTOCITY等。

我尝试使用

从java调用PayPal沙箱
  • Apache HttpClient GET请求
  • Apache HttpClient POST请求
  • javax.net.ssl.HttpsURLConnection中
  • java.net.URLConnection中

我尝试在mac OS X上运行JBoss 7.1.1中的webapp,在win8上运行JBoss 7.2.0。

我还尝试将端口号明确地放在URL中(https://api-3t.sandbox.paypal.com:443

结果总是一样的。当我从java调用它时,付款人信息(名称,地址)丢失了。

有没有人知道出了什么问题?

UPDATE :从Eclipse调用PayPal沙箱(Apache HttpClient GET请求)会返回正确的响应。所以我认为这可能与JBoss AS有关。

1 个答案:

答案 0 :(得分:0)

调用SetExpressCheckout后,您必须将买方重定向到PayPal(https://www.paypal.com/cgi-bin/webscr?cmd=_express-checkout&token=__MY_TOKEN__)并让他们登录并批准付款。在他们完成并返回到您的网站后,请致电GetExpressCheckoutDetails以检索他们的信息。