Test Paypal IPN in the Sandbox
I am writing a script to handle the paypal IPN, so when someone buys something via paypal it will send them an email and write some info into a database.
I am using the Instant Payment Notification simulator, and it is sending my email ok but i would like it to actually re-direct to my php page, so i can test my error checking etc. When you submit it does call the page but i would like to 开发者_如何学JAVAactually be re-directed to it.
Anyone know if this is possible, or if there is anything i can do to 'fake' this process
Cheers Luke
Well, you can just test your IPN by using a temporary Payment Data Transfer
page. Read this page for more information about this.
So basically after your payment has been done it redirects you to that success page and does everything. So you can use the success page as a test version of your future IPN page. After your script is working exactly the way you want, you can use the code on that page by simply copy-pasting it into your IPN page
and deleting that test PDT page.
Another way is to catch the entire output of your IPN page and mail it to you. Or store it somewhere. To do this, make use of PHP's output buffering.
I hope that makes sense to you...
I usually use micahcarrick Paypal IPN class for Paypal IPN.In this class you can see success case in switch case statement, There you can redirect to your success page.
Actually, Paypal IPN will return response to us. you can see the action parameter in return url. using this you can find is payment is success or cancel or any error during payment.
Hope it helps,Thanks
Paypal IPN messages are Server to Server Messages for asynchronously receiving messages from Paypal regarding transactions. The HTTP Client used by Paypal to deliver IPN message to your server may not support redirect requests. As these HTTP requests are not coming from users browsers' output from your Php script is irrelevant. If you want to do any extended processing you have to incorporate that into your IPN Handler.
精彩评论