我正在使用paypal沙盒。在客户付款后我的项目中,我必须将正式收据编号存储到数据库中。所以我创建了一个servlet作为我的返回URL,我想根据事务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 - 收据识别号
所以我认为这应该是我正在寻找的,但它不在回应中。这是回复。
RECEIVERBUSINESS=morbidcode666@gmail.com
RECEIVEREMAIL=morbidcode666@gmail.com
RECEIVERID = P687QZN7HUBGE
EMAIL=pyroclastic33@gmail.com
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和这个交易的东西非常新。我该怎么办?
答案 0 :(得分:1)
只有当有人通过PayPal结账页面上的第二个选项(使用信用卡或借记卡付款)付款时,才会返回变量“RECEIPTID”。
如果有人通过PayPal帐户付款,则不会收到“RECEIPTID”。