PayPal integration woes: PDT hangs on return to site
- by Tom
Hi,
I'm implementing PayPal IPN & PDT. After some headache & time at the sandbox, IPN is working well and PDT returns the correct $_GET data. The implementation is as follows:
Pass user ID in form to PayPal
User buys product and triggers IPN which updates database for given user ID
PDT returns transaction ID when user returns to site
The return page says "please wait" and repeat-Ajax-checks for the transaction status
User is redirected to success/failure page
Everything works well, EXCEPT that when using the PayPal ready PHP code for PDT to do a return POST, the page hangs. PayPal waits for a response and the user never gets back to my site. I'm not getting a fail status, just nothing. The funny thing is that once the unknown error occurs, my test domain becomes unresponsive for a short period.
The code (PHP): https://www.paypal.com/us/cgi-bin/webscr?cmd=p/xcl/rec/pdt-code-outside
If I comment out the POST back, it all works fine. I'm able to pin down the problem to once the code enters the while{} loop. Unfortunately, I'm not experienced enough to write a replacement from scratch for the PayPal code, so would really appreciate any ideas on what might be wrong.
The POST back goes to ssl://www.sandbox.paypal.com, and I'm using button code and an authorisation token that have all been created via a sandbox test account.
Thanks in advance.