Search code examples
jsppaypalpaypal-sandboxpaypal-pdt

Can't configure PDT or IPN in paypal


I am doing an web application with java, and I want to use paypal api. My app is running in my machine(in localhost) by apache non in internet. I have created an accaunt in paypal.developper for example [email protected] . I have created some sandbox accaunt(a buyer: [email protected], and a bussines seller [email protected]) and I have run some tests and everything work fine.

My problem is : I can't configure PDT (Payement Data Transfer) or IPN(Instant payement notification).

I went to my paypal profile-Selling Tools-Website preferences. I click on auto Return : ON, PDT:ON, and in return url : http://127.0.0.1/myproject/prenotationIsDone.jsp I save it, it shows me my identity token.

Now when I run some test, it doesn't even do auto-return, it does the payement just like when I did the test on the sandbox accaunt:

I do something like this :

  <form name="paypalForm" action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post">  
<input type="hidden" name="cmd" value="_xclick" />
     <input type="hidden" name="business" value="[email protected]" />

     <input type="hidden" name="custom" value="1123" />
     <input type="hidden" name="item_name" value="Camera" />
     <input type="hidden" name="amount" value="20"/>
     <input type="hidden" name="rm" value="1" />
     <input type="hidden" name="return" value="http://127.0.0.1/myproject/prenotationIsDone.jsp" />
     <input type="hidden" name="cancel_return" value="http://127.0.0.1/myproject/cancel.jsp" />


           <input type="submit" value="Continua! "/>

Even if i change the email to the sandbox bussines email: [email protected] it will be the same. It just do the payement without auto return and with using PDT.

in the jsp file I will have some line like this :

Enumeration en = request.getParameterNames();

while(en.hasMoreElements()){
String paramName = (String)en.nextElement();

out.println("parameters"+ paramName);
}

Of course there aren't any parameter like tx because PDT doesn't work. Any idea how to fix this ?

And the second problem: I have seen that IPN( and PDT too but I am not sure about PDT) doesn't work in a local server, because it needs to be seen by outside in the net. How can i fix this ? I tried this steps but I guess I have done something wrong: First I changed the ports of apache from 8080 which is the default to port 80. I went to router , in NAT and I port-foward the port 80, in the external ip(the one in www.whatismyip.com). for example it will be: 198.122.141.2 Now when I try in browser 198.122.141.2:80/myproject/index.jsp it shows nothing, or it says the object can't be found. Even so, I try do set up a dynamic ip, dydns or noip it will be somethin myproject.ns0.it/myproject/index.jsp and it doesn't show anything.

Please someone can help me how to resolve this problems, or is there any other way to verify the payements of paypal in my local server. Thank you for your time, and sorry for my english


Solution

  • I resolved the PDT part so I will post my solution. I want pdt to work in sandbox. First I create an accaund on paypal developper. Next in Application- Sandbox accaunt- I create a buyer(or more) and a business accaunt. I click on the profile of business accaunt(ex [email protected]) and I click change password.(This is the part I was missing in I asked the question). Then I click Enter SandboxSite ,I log in with the email and password that was just created. IN profile-Selling Tools-Website preferences. I click on auto Return : ON, PDT:ON, and the return and cancel url. Now everything work fine.