我正在使用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
电子邮件= pyroclastic33@gmail.com
PAYERID = PA88PWZ8HKGDN
PAYERSTATUS =验证
COUNTRYCODE =我们
商业=病态代码的测试存储
SHIPTONAME=病态代码的测试存储
SHIPTOSTREET=1 Main street
圣何塞SHIPTOCITY =
SHIPTOSTATE = CA
我们SHIPTOCOUNTRYCODE =
美国SHIPTOCOUNTRYNAME =
SHIPTOZIP = 95131
PayPal ADDRESSOWNER =
ADDRESSSTATUS =确认
SALESTAX = 0.00
SHIPAMOUNT = 0.00
SHIPHANDLEAMOUNT = 0.00
SHIPDISCOUNT = 0.00
INSURANCEAMOUNT = 0.00
时间戳= 2015 - 09 - 27 - t08:33:14z
CORRELATIONID = 930 df496bece1
ACK =成功
版本= 124.0
构建= 17750617
FIRSTNAME =病态
代码LASTNAME =
TRANSACTIONID = 5 wa70930ek241520g
TRANSACTIONTYPE = webaccept
PAYMENTTYPE =即时
ORDERTIME = 2015 - 09 - 27 - t08:32:59z
AMT = 10.00
FEEAMT = 0.59
TAXAMT = 0.00
CURRENCYCODE =美元
PAYMENTSTATUS =
完成PENDINGREASON =没有
REASONCODE =没有
SHIPPINGMETHOD =默认
PROTECTIONELIGIBILITY =合格
PROTECTIONELIGIBILITYTYPE = ItemNotReceivedEligible % 2 cunauthorizedpaymenteligible
L_QTY0 = 1
L_TAXAMT0 = 0.00
L_CURRENCYCODE0 =美元
L_TAXABLE0 = false
我是非常新的贝宝和这个交易的东西。我该怎么办?
变量"RECEIPTID"仅在某人通过PayPal结帐页面上的第二个选项(使用信用卡或借记卡支付)付款时返回。
如果有人通过PayPal帐户付款,则没有"RECEIPTID"。