2015-09-27 79 views
0

我正在使用貝寶沙箱。在客戶付款後的我的項目中,我必須將正式收據編號存儲到數據庫中。所以我創建了一個作爲我的返回URL的servlet,我想根據事務ID檢索OR數。我使用buynow按鈕使用標準付款方式。這是我獲取交易細節的代碼。貝寶沙箱響應中未返回的收據編號

HttpClient client = HttpClients.createDefault(); 
HttpPost post = new HttpPost("https://api-3t.sandbox.paypal.com/nvp"); 
List<NameValuePair> params = new ArrayList<>(); 
params.add(new BasicNameValuePair("METHOD","GetTransactionDetails")); 
params.add(new BasicNameValuePair("VERSION","124.0")); 
params.add(new BasicNameValuePair("USER", "morbidcode666_api1.gmail.com")); 
params.add(new BasicNameValuePair("PWD","L66QPRP2RTRB9NEA")); 
params.add(new BasicNameValuePair("SIGNATURE", "AUT-r5lylj2D9Bdu1rj5Xzp05w8eAMod08fTK-pwniTNTHScwi4w9jdh")); 
params.add(new BasicNameValuePair("TRANSACTIONID",request.getParameter("tx"))); 
post.setEntity(new UrlEncodedFormEntity(params, "UTF-8")); 
HttpResponse postresponse = client.execute(post); 
HttpEntity entity = postresponse.getEntity(); 
System.out.println(EntityUtils.toString(entity)); 

https://developer.paypal.com/docs/classic/api/merchant/GetTransactionDetails_API_Operation_NVP/

RECEIPTID - 收據的識別號

,所以我想這應該是正是我要找的,但它不是在響應中。這是迴應。

[email protected]
[email protected]
RECEIVERID = P687QZN7HUBGE
[email protected]
PAYERID = PA88PWZ8HKGDN
PAYERSTATUS =驗證
COUNTRYCODE = US
BUSINESS =病態代碼的測試商店
SHIPTONAME =病態代碼的測試商店
SHIPTOSTREET = 1 MAIN ST
SHIPTOCITY =聖何塞
SHIPTOSTATE = CA
SHIPTOCOUNTRYCODE = US
SHIPTOCOUNTRYNAME =美國
SHIPTOZIP = 95131
ADDRESSOWNER =貝寶
ADDRESSSTATUS =確認
銷售稅= 0.00
SHIPAMOUNT = 0.00
SHIPHANDLEAMOUNT = 0.00
SHIPDISCOUNT = 0.00
INSURANCEAMOUNT = 0.00
TIMESTAMP = 2015-09-27T08:33:14Z
CORRELATIONID = 930df496bece1
ACK =成功
VERSION = 124.0
BUILD = 17750617
FIRSTNAME =病態
LASTNAME =代碼
TRANSACTIONID = 5WA70930EK241520G
TRANSACTIONTYPE = webaccept
PAYMENTTYPE =即時
ORDERTIME = 2015-09-27T08: 32:59Z
AMT = 10.00
FEEAMT = 0.59
TAXAMT = 0.00
CURRENCYCODE = USD
PAYMENTSTATUS =完成
PENDINGREASON =無
REASONCODE =無
SHIPPINGMETHOD =默認
PROTECTIONELIGIBILITY =合格
PROTECTIONELIGIBILITYTYPE = ItemNotReceivedEligible%2cUnauthorizedPaymentEligible
L_QTY0 = 1
L_TAXAMT0 = 0。00
L_CURRENCYCODE0 = USD
L_TAXABLE0 =假

我非常新的PayPal和本次交易的東西。我該怎麼辦?

回答

1

變量「RECEIPTID」僅在PayPal結賬頁面通過第二個選項(使用信用卡或借記卡支付)支付時纔會返回。

如果有人通過PayPal賬戶支付,沒有「RECEIPTID」。