0
votes

I'm using paypal sandbox. In my project after the customer pays I have to store the official receipt number to the database. So I created a servlet that serves as my return URL, and their I would like to retrieve the OR number based on the transaction id. I am using the standard payment method with a buynow button. Here is my code for getting the transaction details.

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));

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

RECEIPTID - Receipt identification number

so I think this should be exactly what I'm looking for, but it's not in the response. Here is the response.

[email protected]
[email protected]
RECEIVERID=P687QZN7HUBGE
[email protected]
PAYERID=PA88PWZ8HKGDN
PAYERSTATUS=verified
COUNTRYCODE=US
BUSINESS=Morbid Code’s Test Store
SHIPTONAME=Morbid Code’s Test Store
SHIPTOSTREET=1 Main St
SHIPTOCITY=San Jose
SHIPTOSTATE=CA
SHIPTOCOUNTRYCODE=US
SHIPTOCOUNTRYNAME=United States
SHIPTOZIP=95131
ADDRESSOWNER=PayPal
ADDRESSSTATUS=Confirmed
SALESTAX=0.00
SHIPAMOUNT=0.00
SHIPHANDLEAMOUNT=0.00
SHIPDISCOUNT=0.00
INSURANCEAMOUNT=0.00
TIMESTAMP=2015-09-27T08:33:14Z
CORRELATIONID=930df496bece1
ACK=Success
VERSION=124.0
BUILD=17750617
FIRSTNAME=Morbid
LASTNAME=Code
TRANSACTIONID=5WA70930EK241520G
TRANSACTIONTYPE=webaccept
PAYMENTTYPE=instant
ORDERTIME=2015-09-27T08:32:59Z
AMT=10.00
FEEAMT=0.59
TAXAMT=0.00
CURRENCYCODE=USD
PAYMENTSTATUS=Completed
PENDINGREASON=None
REASONCODE=None
SHIPPINGMETHOD=Default
PROTECTIONELIGIBILITY=Eligible
PROTECTIONELIGIBILITYTYPE=ItemNotReceivedEligible%2cUnauthorizedPaymentEligible
L_QTY0=1
L_TAXAMT0=0.00
L_CURRENCYCODE0=USD
L_TAXABLE0=false

I am extremely new to paypal and this transaction stuff. What should I do?

1

1 Answers

2
votes

The variable "RECEIPTID" is only returned if someone pays via the second option ( Pay with credit or debit card) on the PayPal checkout Page .

No "RECEIPTID" if someone pays via PayPal account .